Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v3: custom pipelines #747

Closed
wants to merge 10 commits into from
Closed

Conversation

Th3G33k
Copy link

@Th3G33k Th3G33k commented May 9, 2024

Add get_text_embeddings and get_similarities methods to ImageFeatureExtractionPipeline

@xenova
Copy link
Owner

xenova commented May 9, 2024

Thanks! Are these methods present in the python version of the image feature extraction pipeline? If so, can you please link to the original documentation? If not, please note that we're trying to match the python API as closely as possible, and may make it difficult to merge the PR.

@Th3G33k
Copy link
Author

Th3G33k commented May 9, 2024

I don't think there in an equivalent in Python transformers.

transformers.js/src/models.js

Lines 5816 to 5821 in 880cd3e

// NOTE: This is custom to Transformers.js, and is necessary because certain models
// (e.g., CLIP) are split into vision and text components
const MODEL_FOR_IMAGE_FEATURE_EXTRACTION_MAPPING_NAMES = new Map([
['clip', ['CLIPVisionModelWithProjection', CLIPVisionModelWithProjection]],
['siglip', ['SiglipVisionModel', SiglipVisionModel]],
])

However, I think it would be really handful to have those fonctions directly into the library transformers.js image feature extraction pipeline.

It's used in hugging face spaces and in examples model code

@Th3G33k
Copy link
Author

Th3G33k commented May 10, 2024

To not differ from the Python library, I will add the custom pipeline separetely, with register_pipeline. #684

Th3G33k and others added 5 commits May 10, 2024 23:48
* Add RawAudio class and 'save to wav'

* Apply suggestions from code review

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

* RawAudio toBlob() + save() rewrite

* Add saveBlob in utils/core.js

* RawAudio : Add support 2 channels + interleave

* Fix

* Fix

* simplify type check

* RawAudio : improve interleave + change env -> apis

* image.js: change env -> apis

* env.js remove changes

---------

Co-authored-by: Joshua Lochner <admin@xenova.com>
* Add custom task `register_pipeline`

* Change model_name in register_pipeline

* add custom tasks to SUPPORTED_TASKS

* models.js getModelClassFromName + refactor model mapping

* models.js fix model mapping

* Beautify code

* Allow updating existing supported_tasks
* v3: wasmPaths relative path

* Onnx InferenceSession logLevel

* remove logLevel

* set logLevel

* Beautify code
@Th3G33k Th3G33k changed the title v3: Improve image-feature-extraction v3: custom pipelines May 11, 2024
Th3G33k and others added 2 commits May 11, 2024 07:10
* Add `ignore_merges` option to BPE tokenizers (xenova#716)

* [version] Update to 2.17.1

* Use ungated version of mistral tokenizer (xenova#718)

* Add mobilevitv2 (xenova#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`

* docs: update vanilla-js.md (xenova#738)

minor fix

* Support reading data from blob URI (xenova#645)

* Make blob as valid URL

* Create function to detect the blob URI

* Change to `isValidUrl`

* Remove comment

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

* Merge `isValidHttpUrl` into `isValidUrl`

* Correct implement

* Update docs

* Add test

* Remove export for `isValidUrl`

* Test read blob via `getFile`

* Use `res.text()` instead `res.body`

---------

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

* Add aggregation_strategy + start end tokens

* Beautify code

* tokenizers return_offsets_mapping

* QuestionAnswering start end char

---------

Co-authored-by: Joshua Lochner <admin@xenova.com>
Co-authored-by: Ikko Eltociear Ashimine <eltociear@gmail.com>
Co-authored-by: Hans <me@hans00.me>
@Th3G33k Th3G33k closed this May 11, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants