Commit Graph

1052 Commits

Author SHA1 Message Date
Joshua Lochner 57487744e7 [version] Update to 2.10.0 2023-12-05 15:34:53 +02:00
Joshua Lochner ac466e6198 Remove old workflow files 2023-12-05 12:43:26 +02:00
Joshua Lochner b1a4b58e86 Update processor unit test's max execution time 2023-12-05 12:37:51 +02:00
Joshua Lochner c5ed1d70ca
Add support for CLAP (`zero-shot-audio-classification`) and Audio Spectrogram Transformer (`audio-classification`) (#427)
* Add FFT unit tests

* Refactor maths.js and audio.js

* Refactor audio processors

* Add support for AST models

* Add another audio-classification example

* Add audio processing unit tests

* Implement `log_mel='dB'` in `spectrogram` function

* Add `ClapFeatureExtractor`

* Implement `ClapFeatureExtractor` unit tests

* Add support for `CLAP`

* Add `ZeroShotAudioClassificationPipeline`

* Add listed support for  `zero-shot-audio-classification` pipeline tag

* Cleanup

* `let` -> `const`

* Update `mel_filter_bank` unit test

* Add `'Xenova/tiny-random-ClapModel'`

* Add `ClapAudioModelWithProjection` and `ClapTextModelWithProjection`

* Move audio validation to helper function

* Optimize `mel_filter_bank` computation

-30ms

* Update mel filters unit test

* Cleanup

* Optimizations

* Fix jsdoc

* Optimizations

* Add WIP conversion scripts

Will be updated once https://github.com/huggingface/optimum/pull/1552 is merged
2023-12-05 12:17:42 +02:00
Joshua Lochner 6f05572854
Add support for ConvNeXT (V1+V2) models (#428)
* Add support for `convnext` and `convnextv2` models

* Fix typo
2023-12-02 17:33:21 +02:00
Joshua Lochner 3da3841811
Support decoding of tensors (#416)
* Support decoding of tensors (Closes #362)

* Remove debug line
2023-12-02 16:17:57 +02:00
Joshua Lochner 768a2e26d7 [version] Update to 2.9.0 2023-11-21 14:51:11 +02:00
Joshua Lochner 83dfa4718e
Add `depth-estimation` w/ DPT and GLPN (#389)
* Add `size` getter to `RawImage`

* Add `DPTFeatureExtractor`

* Add depth-estimation w/ DPT models

* Add GLPN models for depth estimation

* Add missing import in example

* Add `DPTFeatureExtractor` processor test

* Add unit test for GLPN processor

* Add support for `GLPNFeatureExtractor`

Uses `size_divisor` to determine resize width and height

* Add `GLPNForDepthEstimation` example code

* Add DPT to list of supported models

* Add GLPN to list of supported models

* Add `DepthEstimationPipeline`

* Add listed support for depth estimation pipeline

* Add depth estimation pipeline unit tests

* Fix formatting

* Update `pipeline` JSDoc

* Fix typo from merge
2023-11-20 15:43:45 +02:00
Joshua Lochner 5ddc4722f3
Add support for nougat models (`image-to-text`) (#391)
* Add `NougatTokenizer`

* Add nougat unit tests

* Add support for `NougatImageProcessor`

* Add `crop` function to `RawImage`

* Fix `RawImage` save function

OffscreenCanvas does not have `toDataURL` function

* Add listed support for nougat models

* Fix `min`/`max` function typing

* Add unknown token to tokenizer class

* Implement `NoBadWordsLogitsProcessor`

* Use `NoBadWordsLogitsProcessor` in `generate`

* Fix regex group substitutions

Python uses \1, \2, etc. for group substitutions, but JavaScript uses $1, $2, etc.

* Create `regexSplit` helper function to split but keep delimiter

* Fix splitting for String pattern types

* Fix docstring
2023-11-20 15:14:11 +02:00
Joshua Lochner 7cf8a2c442
Add `zero-shot-object-detection` w/ OwlViT (#392)
* Set `batch_size=1` for owlvit exports

* Add support for owlvit models

* Update default quantization settings

* Add list of supported models

* Revert update of owlvit quantization settings

* Add `OwlViTProcessor`

* Move `get_bounding_box` to utils

* Add `ZeroShotObjectDetectionPipeline`

* Add unit tests

* Add owlvit processor test

* Add listed support for `zero-shot-object-detection`

* Add OWL-ViT to list of supported models

* Update README.md

* Fix typo from merge
2023-11-20 14:34:56 +02:00
Hermann Rolfes b5ef835c7d
Fix NaNs when using ORT proxy (#404)
* Move tensor clone for Worker ownership NaN issue

* Update src/models.js - Use conditional operator

Co-authored-by: Joshua Lochner <admin@xenova.com>

* Update src/models.js - Object.create(null)

Co-authored-by: Joshua Lochner <admin@xenova.com>

* tensor.js: remove "Object" type to fix types (since ONNX exports correct type now)

* models.js / validateInputs(): Remove promise/await because it is not needed
Use "tensor instanceof Tensor" check because otherwise validateInputs() thinks it has an input even if it doesn't

* Fix JSDoc

* Update JSDoc

---------

Co-authored-by: Joshua Lochner <admin@xenova.com>
2023-11-20 14:32:15 +02:00
Dominik Weckmüller ac0096e33d
Add default `token_type_ids` for multilingual-e5-* models (#403)
* Fix #267 & #324

Add default token_type_ids. Fix for multilingual-e5-* family.

* Add add_token_types import

* export `add_token_types`

* Improvements

---------

Co-authored-by: Joshua Lochner <admin@xenova.com>
2023-11-20 00:44:35 +02:00
Joshua Lochner b8719b12dd
Ensure WASM fallback does not crash in GH actions (#402)
* Ensure WASM fallback does not crash in GH actions

* Add unit test for WordPiece `max_input_chars_per_word`

* Cleanup

* Set max test concurrency to 1
2023-11-19 08:06:49 +02:00
Joshua Lochner 19daf2d3c1
Add jsDelivr stats to README (#395) 2023-11-18 12:59:15 +02:00
Joshua Lochner 6fc268cb23
Update sharp dependency version (#400) 2023-11-18 12:58:21 +02:00
Sam L'Huillier c8bbdd41f4
Implement max character check for WordPiece tokenizer (#398)
* Implement max character check per token

* Update maxInputCharsPerWord to max_input_chars_per_word

Co-authored-by: Joshua Lochner <admin@xenova.com>

* Update maxInputCharsPerWord to max_input_chars_per_word

Co-authored-by: Joshua Lochner <admin@xenova.com>

* Update to ??

Co-authored-by: Joshua Lochner <admin@xenova.com>

---------

Co-authored-by: Joshua Lochner <admin@xenova.com>
2023-11-17 21:48:55 +02:00
Victor Nogueira 4e4148cb5c
Add support for Grouped Query Attention on Llama Model (#393)
Resolves #388
2023-11-15 17:51:33 +02:00
Joshua Lochner 35d61f5cc9
Add `CLIPFeatureExtractor` (and tests) (#387) 2023-11-15 16:28:29 +02:00
Joshua Lochner c98073042f [version] Update to 2.8.0 2023-11-09 18:00:58 +02:00
Joshua Lochner 73a99ba0af
Add image-to-image task w/ Swin2SR (for super-resolution) (#381)
* Add `Swin2SRImageProcessor`

* Add `RawImage.fromTensor` helper function

* Add clamp tensor function

* Add support for `.to` data type conversion

* Add `round` tensor function

* Add support for `mul` tensor function

* Fix image padding

* Only perform padding if it will affect size

* Create basic processors unit test suite

* Add SamProcessor test case

* Move `CONTENT_TYPE_MAP` outside `RawImage` class

* Perform reflective padding for swin2sr models

* Add swin2sr models for image super-resolution

* Add listed support for Swin2SR models

* Add image-to-image pipeline

* Add listed support for image-to-image task

* Add image-to-image unit tests

* Add `add` tensor functions

* Generalize `pad_image` helper function

* Add more unit tests for image processors

* Fix typo
2023-11-09 17:57:32 +02:00
Joshua Lochner 3e8d227247
Add support for Falcon and Mistral models (#379)
* By default, do not add special tokens in text-generation

See 147e8ce4ae/src/transformers/pipelines/text_generation.py (L106)

* Add support for mistral models

* Add support for Falcon models

* Replace `batch_size` with variable

* Add Falcon to list of supported models

* Fix typing issue with bigint literals
2023-11-09 16:43:51 +02:00
Joshua Lochner 96c5dd4ccf
Fix `text2text-generation` pipeline output inconsistency w/ python library (#384)
* Fix `text2text-generation` pipeline inconsistency

See https://huggingface.co/docs/transformers/v4.35.0/en/main_classes/pipelines#transformers.Text2TextGenerationPipeline

* Fix `text2text-generation` example in docs

* Improve text2text-generation output in docs
2023-11-09 16:08:27 +02:00
Joshua Lochner e440372c99
Fix typo in docs (#385) 2023-11-08 20:02:38 +02:00
Joshua Lochner 6b6e03bcd3
Add support for TrOCR models (for Optical Character Recognition) (#375)
* Add support for `TrOCR` models

* Add example code snippet for OCR
2023-11-08 18:21:40 +02:00
Joshua Lochner f7321addc0
Fix Firefox bug when displaying progress events while reading file from browser cache (#374)
* Fix firefox bug

Do not display progress events when reading from browser cache in Firefox.

* Typo
2023-11-08 18:03:10 +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 e5fd695551 Fix typo 2023-10-23 17:55:33 +02:00
Joshua Lochner 1ca6999589 Update README.md 2023-10-23 16:39:37 +02:00
Joshua Lochner d0915294ae [version] Update to 2.7.0 2023-10-23 16:39:27 +02:00
Joshua Lochner 68067de199 Add listed support for speecht5 2023-10-23 16:38:25 +02:00
Joshua Lochner 4a991bd911
Add support for `text-to-speech` (w/ Speecht5) (#345)
* Add vocoder to export

* Add tokenizer.json export for speecht5 models

* Update speecht5 supported models

* Create `SpeechT5Tokenizer`

* Add `ones` and `ones_like` tensor functions

* Add support for speecht5 text-to-speech

* Disambiguate `SpeechSeq2Seq` and `Seq2SeqLM`

* Create `TextToAudioPipeline`

* Add listed support for `text-to-audio` / `text-to-speech`

* Use unquantized vocoder by default

* Skip speecht5 unit tests for now

Due to bug in transformers: https://github.com/huggingface/transformers/issues/26547

* Update example pipeline output

* Create simple in-browser TTS demo

* Add template README

* Delete package-lock.json

* Update required transformers.js version

* Add link to Transformers.js

* Double -> Single quotes

* Add link to text-to-speech demo

* Update sample speaker embeddings
2023-10-23 16:31:46 +02:00
Joshua Lochner 983cf3a246 Update example app dependencies 2023-10-22 10:36:23 +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 40df3cc003 Update link to hosted pretrained models 2023-10-04 17:59:50 +02:00
Joshua Lochner a45b8441d3
Improve electron example template (#342)
* Update transformers.js version

* Use Singleton object in electron tutorial

* Create package-lock.json

* Remove models folder

* Remove step for copying models to local folder
2023-10-04 17:45:25 +02:00
Joshua Lochner e7b71b8f8f
Add more links to example section (#343) 2023-10-04 17:44:46 +02:00
Joshua Lochner 0efa60ffff
Do not post-process `<` and `>` symbols generated from docs (#335)
* Do not post-process `<` and `>` symbols generated from docs

* Fix typo
2023-10-04 15:43:35 +02:00
Joshua Lochner b6bd608322
Update falcon tokenizer (#344)
* Update generate_tests.py

* Do not add token types for `FalconTokenizer`
2023-10-03 12:35:07 +02:00
Joshua Lochner 5b31129218 [version] Update to 2.6.2 2023-09-27 15:15:09 +02:00
Hermann Rolfes 09cbb0c2e7
Fix more `_call` LSP errors + extra typings (#304)
* types are only inferred through this assignments in constructor

* Typing PreprocessedImage

* LSP + other typings for ImageFeatureExtractor / SamImageProcessor / DetrFeatureExtractor

* Fix SamProcessor error

* Fix PretrainedOptions

* Fix double AnyTypedArray

* Update `unused` variable name

* Mark `_update` image function as private

* Update processor JSDoc

---------

Co-authored-by: Joshua Lochner <admin@xenova.com>
2023-09-27 15:12:59 +02:00
Joshua Lochner df94965ea2
Use `doc-builder` main (#331) 2023-09-27 00:24:54 +02:00
Joshua Lochner f83d079621
Revert doc builder (#330)
* Update pr-documentation.yml

* Update documentation.yml
2023-09-26 21:31:00 +02:00
Joshua Lochner 4d8a590fb3
Add support for `LongT5` models (#316)
* Create `LongT5` classes

* Update model mappings

* Add `LongT5` to supported list of models

* Update list of supported models
2023-09-26 18:25:12 +02:00
Joshua Lochner d307f270dd
Add support for `DonutSwin` models (#320)
* Add `add_special_tokens` option to tokenizers

* Improve error messages for loading processors

* Add `DonutFeatureExtractor`

* Add `DonutSwinModel` and `MBartForCausalLM` models

* Fix `addPastKeyValues` for `VisionEncoderDecoder` models

* Add `Donut` to list of supported models

* Make encode parameters optional

* Support batched decoder input ids

* Remove unused import

* Add `do_thumbnail` for donut image processing

* Fix `TypeError: decoder_input_ids[i].map is not a function`

* Only pad if width and height specified in size

* Only pad if `pad_size` is defined

* Only cut `decoder_input_ids` if past model output

* Add donut model

* Add example usage to JSDoc for `DonutSwinModel`

* Add support for `DocumentQuestionAnsweringPipeline`

* Add simple document question answering unit test

* Add listed support for document QA pipeline
2023-09-26 17:46:26 +02:00
Joshua Lochner 222d33acf0 Use `transformers==4.33.2` in conversion script 2023-09-23 17:06:27 +02:00
Joshua Lochner 69aa5dff58 Freeze conversion script requirements
Will be upgraded when we switch to `onnxruntime>=1.16`
2023-09-23 16:56:52 +02:00
Joshua Lochner dac6f4b073
Improve example browser extension template (#325)
Removes unnecessary complexity
2023-09-23 03:34:10 +02:00
Joshua Lochner 982498c064
Create in-browser version of `semantic-image-search` example app (#326)
* Create in-browser version of `semantic-image-search`

* Add loading model and database message

* Create README.md

* Add link to example app
2023-09-23 02:54:28 +02:00
Joshua Lochner c367f9d68b
Add support for `Blenderbot` and `BlenderbotSmall` (#292)
* Add support for `Blenderbot` models

Closes #37
References #29

* Add support for `BlenderbotTokenizer`

* Add blenderbot to supported models

* Add support for `BlenderbotSmallTokenizer`

* Add custom tests for blenderbot-small

* Add support for `BlenderbotSmall` models

* Update list of supported models

* Improve `addPastKeyValues` function

* Allow skipping of adding encoder past key values
2023-09-19 13:34:00 +02:00
Joshua Lochner c453e6be32 Add `LLaMA`/`Llama2` to list of supported models 2023-09-19 01:36:36 +02:00