Skip to content

feat: Image embeddings #397

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

Merged
merged 7 commits into from
Jun 25, 2025
Merged

feat: Image embeddings #397

merged 7 commits into from
Jun 25, 2025

Conversation

pweglik
Copy link
Contributor

@pweglik pweglik commented Jun 13, 2025

Description

Introducing image embeddings feature.
TODO:
benchmarks
Everything else is good to review.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update (improves or adds clarity to existing documentation)

Tested on

  • iOS
  • Android

Related issues

#353

Checklist

  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have updated the documentation accordingly
  • My changes generate no new warnings

Additional notes

@pweglik pweglik requested review from JakubGonera and chmjkb June 13, 2025 10:27
@pweglik pweglik marked this pull request as draft June 13, 2025 10:27
@pweglik pweglik self-assigned this Jun 13, 2025
@pweglik pweglik force-pushed the @pw/image-embeddings branch from 69456e3 to 2157bec Compare June 13, 2025 14:26
@pweglik pweglik force-pushed the @pw/image-embeddings branch from aacc266 to 4cbe3a2 Compare June 24, 2025 11:03
@pweglik pweglik marked this pull request as ready for review June 24, 2025 11:10
@chmjkb chmjkb removed the request for review from JakubGonera June 24, 2025 11:19
**`modelSource`**
A string that specifies the location of the model binary. For more information, take a look at [loading models](../fundamentals/loading-models.md) page.

**`preventLoad?`** - Boolean that can prevent automatic model loading (and downloading the data if you load it for the first time) after running the hook.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
**`preventLoad?`** - Boolean that can prevent automatic model loading (and downloading the data if you load it for the first time) after running the hook.
**`preventLoad?`** - Boolean that can prevent automatic model loading (and downloading the model if you load it for the first time) after running the hook.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

i copied it over from other pages. I'd leave it like that - I think we actually mean it. Model loading (which mean downloading a lot of data)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yes, but it might be misleading what data we mean


// Running the model
const embedding = await ImageEmbeddingsModule.forward(
'https://url-to-image.jpg'
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

in general i don't like things that would compile without error here, I saw too many peoples just copying it and then being upset about the url not working. Just a thought tho

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That's good point, but on the other hand it shows that any existing URL works - '...' doesn't transfer this knowledge

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I was thinking something more like ... which just wouldn't run at all and point to this as an error in code syntax itself


## Loading the model

To load the model, use the `load` method. It accepts the `modelSource` which is a string that specifies the location of the model binary. For more information, take a look at [loading models](../fundamentals/loading-models.md) page. This method returns a promise, which can resolve to an error or void.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
To load the model, use the `load` method. It accepts the `modelSource` which is a string that specifies the location of the model binary. For more information, take a look at [loading models](../fundamentals/loading-models.md) page. This method returns a promise, which can resolve to an error or void.
To load the model, use the `load` method. It accepts `modelSource` which is a string that specifies the location of the model binary. For more information, take a look at [loading models](../fundamentals/loading-models.md) page. This method returns a promise which can resolve to an error or void.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Again - it should be fixed in several pages. I think we should utilize .mdx more

@pweglik pweglik requested a review from mkopcins June 24, 2025 14:07
@pweglik pweglik merged commit 2204e1f into main Jun 25, 2025
3 checks passed
@pweglik pweglik deleted the @pw/image-embeddings branch June 25, 2025 07:56
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.

5 participants