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

Fix sorting on scores #164

Merged
merged 7 commits into from
Jan 21, 2025
Merged

Fix sorting on scores #164

merged 7 commits into from
Jan 21, 2025

Conversation

PaulHax
Copy link
Collaborator

@PaulHax PaulHax commented Jan 9, 2025

After updating the images visible in the image list, all other selected images are updated and their scores computed.
After images are scored, the table sort may have changed the images that are visible, so ImageList is asked to send visible image IDs again, which may trigger a new _update_all_images if the set of images in view has changed.

transformers.pipeline is not async, so we run that in subprocess via multiprocess_predictor.py

@PaulHax PaulHax linked an issue Jan 10, 2025 that may be closed by this pull request
@PaulHax PaulHax force-pushed the sort-fix branch 3 times, most recently from fc57b5a to eb7993b Compare January 10, 2025 18:03
@PaulHax PaulHax marked this pull request as ready for review January 10, 2025 18:24
@PaulHax PaulHax force-pushed the sort-fix branch 5 times, most recently from 4cb801e to 38fcae7 Compare January 15, 2025 16:18
@PaulHax PaulHax linked an issue Jan 15, 2025 that may be closed by this pull request
@PaulHax PaulHax force-pushed the sort-fix branch 3 times, most recently from 7fc0dc1 to f510969 Compare January 15, 2025 18:10
Base automatically changed from cat-filter-tweeks to main January 15, 2025 18:39
@PaulHax PaulHax force-pushed the sort-fix branch 2 times, most recently from e224a44 to e326e4e Compare January 15, 2025 18:49
@PaulHax PaulHax requested a review from alesgenova January 15, 2025 18:54
@PaulHax PaulHax changed the title fix(image_list): sorting on scores works Fix sorting on scores Jan 15, 2025
@PaulHax PaulHax force-pushed the sort-fix branch 3 times, most recently from 3e5fa3c to 3110baa Compare January 20, 2025 21:54
Copy link
Member

@alesgenova alesgenova left a comment

Choose a reason for hiding this comment

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

Looks good, I just had a couple of optional comments

logger = logging.getLogger(__name__)
logger.setLevel(logging.INFO)


class LazyDict(Mapping):
Copy link
Member

Choose a reason for hiding this comment

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

Nice utility!
According to this Mapping is for a read-only maps, and MutableMapping is used for mutable maps. Also an implementation for __delitem__() is missing.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

payload = msg.get("payload", {})
logger.debug(f"Worker: Received {command} with ID {req_id}")

if command == "SET_MODEL":
Copy link
Member

Choose a reason for hiding this comment

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

I think we should place these command strings in some constant/enum, since we refer to them in different parts of the application.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Sounds good. Let me do that in another PR right now, as I've made a mess of the history and modifed this file in the following PRs.

@PaulHax PaulHax merged commit aebf824 into main Jan 21, 2025
12 checks passed
@PaulHax PaulHax deleted the sort-fix branch January 21, 2025 19:50
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.

Plot all transformed images in embedding plot ASAP Fix score based sorting of sampled images in Image List
2 participants