Commit Graph

600 Commits

Author SHA1 Message Date
Joshua Lochner e0157817eb Extract test utilities to separate file 2023-04-19 20:47:58 +02:00
Joshua Lochner abbbe3fab5 Fix `bert_prepare_model_inputs` when tokenizer returns array 2023-04-19 20:47:01 +02:00
Joshua Lochner a3ed4e3f18 Update `GenerationConfig` documentation 2023-04-19 17:48:00 +02:00
Joshua Lochner 47b256a92a Remove unnecessary inheritance from `Function` class 2023-04-18 17:10:09 +02:00
Joshua Lochner aba491e942 [version] Set version to 1.5.0.dev 2023-04-18 17:09:29 +02:00
Joshua Lochner 4f158a5ad5 Move math utility functions to `math_utils.js` 2023-04-17 21:43:30 +02:00
Joshua Lochner cfa37d3c92 Merge `max` and `indexOfMax` functions, and return tuple of results 2023-04-17 21:27:19 +02:00
Joshua Lochner 9bfd126c84 Update package-lock.json 2023-04-17 15:33:53 +02:00
Joshua Lochner d36ba315ec Merge branch 'main' into docs 2023-04-17 15:28:57 +02:00
Joshua Lochner 8330870752 Remove redundant `resolve.fallback` to webpack config
This is already handled by the "browser" option in package.json
2023-04-15 22:33:31 +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 421aa331cd Replace CommonJS imports/exports with ES6 2023-04-13 21:01:44 +02:00
Joshua Lochner 1b9fe0f27c Replace `Math.max` with iterative version in `softmax` function (#83)
TODO: In future, replace all min/max/indexOfMin/indexOfMax functions with functions that return index and value of the minimum/maximum at the same time (like PyTorch).
2023-04-12 03:35:06 +02:00
Joshua Lochner ee1056bb71 [version] Update to v1.4.2 2023-04-11 02:48:24 +02:00
Joshua Lochner 3b9ebf0a08 Add documented support for `image-segmentation` task 2023-04-11 02:44:30 +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 fdfdd625a8 Move `interpolate` and `transpose` method logic from tensor_utils.js to math_utils.js 2023-04-11 01:32:58 +02:00
Joshua Lochner c6f5f16722 Allow filePath to be a URL 2023-04-11 01:30:17 +02:00
Joshua Lochner b1162f310a Exclude imports that use the `node:` protocol when building for the web 2023-04-09 23:39:10 +02:00
Joshua Lochner 6cf12df3c2 Create image segmentation test 2023-04-09 23:34:03 +02:00
Joshua Lochner 46c66b81b7 Create `ImageSegmentationPipeline` 2023-04-09 23:33:28 +02:00
Joshua Lochner a19b498f7e Set return type of `get` function 2023-04-09 23:30:49 +02:00
Joshua Lochner 3b3711643e Allow untyped array to be used in Tensor constructor 2023-04-09 23:30:27 +02:00
Joshua Lochner 34ed29e493 Add `post_process_panoptic_segmentation` function to `DetrFeatureExtractor` 2023-04-09 23:29:18 +02:00
Joshua Lochner b986d41bc2 Expose `Tensor` class from transformers.js 2023-04-09 21:58:53 +02:00
Joshua Lochner b3efaefb1e Add `interpolate` and `sigmoid` functions to tensor_utils.js 2023-04-09 21:56:32 +02:00
Joshua Lochner 3348904138 Add image segmentation model and output classes 2023-04-09 20:44:41 +02:00
Joshua Lochner f529ada1ab Add `facebook/detr-resnet-50-panoptic` to supported models 2023-04-09 20:32:09 +02:00
Joshua Lochner d862626bf0
Merge pull request #72 from ekolve/node-readable-stream
Define ReadableStream from node:stream/web if it doesn't exist
2023-04-08 17:18:12 +02:00
Joshua Lochner f0e47a8536 Fix `ClipTokenizer` (Closes #74) 2023-04-08 13:19:19 +02:00
Joshua Lochner c3f853b488 Use custom build of catharsis for parsing JSDoc
Fixes a few issues in their parser

Fork:
https://github.com/xenova/catharsis

Original:
https://github.com/hegemonic/catharsis
2023-04-07 23:31:58 +02:00
Joshua Lochner eb574bb64f Add `npm run docs` command to generate docs 2023-04-07 16:57:26 +02:00
Joshua Lochner a38a77d8c2 Update types for tokenizers.js 2023-04-07 16:53:53 +02:00
Joshua Lochner b127ceed74 Update `Tensor` JSDoc 2023-04-07 16:53:21 +02:00
Joshua Lochner 606de46947 Update `seq2seqLoadModel` JSDoc 2023-04-07 16:52:50 +02:00
Joshua Lochner c76374fee8 Add `jsdoc-to-markdown` as dev dependency 2023-04-07 16:51:59 +02:00
Joshua Lochner b7d964d4e9 Update `post_process_object_detection` JSDoc 2023-04-07 16:51:33 +02:00
Joshua Lochner 47c367458c Update list of supported text2text-generation models 2023-04-07 14:13:56 +02:00
Eric Kolve f611db0917
Update src/utils.js
Co-authored-by: Joshua Lochner <admin@xenova.com>
2023-04-06 15:05:10 -07:00
Eric Kolve 05bfddba74 defining ReadableStream from node:stream/web if it doesn't exist 2023-04-06 14:31:49 -07:00
Joshua Lochner db26ba1dea [version] Update to v1.4.1 2023-04-06 22:13:56 +02:00
Joshua Lochner ab8b510e33 Add documented support for token classification 2023-04-06 21:52:30 +02:00
Joshua Lochner 915e5fbde9 Do not process special tokens in token classification pipeline 2023-04-06 21:48:20 +02:00
Joshua Lochner 97720512eb [demo] Create token-classification demo (named entity recognition) 2023-04-06 21:47:31 +02:00
Joshua Lochner 41c7519046 Fix Bert pretokenizer regex 2023-04-06 21:40:01 +02:00
Joshua Lochner 12163dd28b Fix tokenization for multilingual Helsinki-NLP models (#70) 2023-04-06 17:36:52 +02:00
Joshua Lochner 682f7a1832 [demo] Update worker.js comments 2023-04-05 21:46:41 +02:00
Joshua Lochner db7678c3a8 [demo] Store promise to pipeline in factory 2023-04-05 21:37:18 +02:00
Joshua Lochner f3f87eba5d Add supported token classification models 2023-04-05 21:27:11 +02:00
Joshua Lochner b6483cc7f5 Extract supported marian models to extra folder 2023-04-05 21:24:11 +02:00