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(studio): package data to send in main thread #860

Merged
merged 1 commit into from
Jan 29, 2025

Conversation

shcheklein
Copy link
Member

@shcheklein shcheklein commented Jan 25, 2025

Fixes root cause of the #858. We'll still need another fix / research on why it was hanging.

There was a race condition since both (main and Studio updates) threads were reading / updating the same live instance values simultaneously.

It seems it might be happening if a training loop is faster then Studio API call (can be when we have a lot of images).

TODO

  • Add tests
  • Do a followup on "Handle exceptions in the Studio thread" fix(studio): handle unexpected exceptions in updates thread #864
  • Can we cut on memory footprint for plots (we read all the files and package them to send into the Studio post) - we can potentially conservatively "cut" them
  • Check what happens if we send images / plots data twice (e.g. images keep coming and we now filter only by `step > current_step- potentially means we could be sending same data twice)

Thank you for the contribution - we'll try to review it as soon as possible. 🙏

@shcheklein shcheklein added bug Did we break something? A: studio Area: Studio integration labels Jan 25, 2025
@shcheklein shcheklein self-assigned this Jan 25, 2025
@shcheklein shcheklein force-pushed the fix-858/race-condition-studio-update branch 2 times, most recently from d34234a to 79f16a2 Compare January 25, 2025 18:16
Copy link

codecov bot commented Jan 25, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 95.35%. Comparing base (f00126a) to head (ca0564e).
Report is 2 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main     #860      +/-   ##
==========================================
+ Coverage   95.29%   95.35%   +0.05%     
==========================================
  Files          55       55              
  Lines        3911     3979      +68     
  Branches      304      309       +5     
==========================================
+ Hits         3727     3794      +67     
  Misses        138      138              
- Partials       46       47       +1     
Flag Coverage Δ
dvclive 95.35% <100.00%> (+0.05%) ⬆️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@shcheklein shcheklein force-pushed the fix-858/race-condition-studio-update branch from 79f16a2 to ca0564e Compare January 25, 2025 21:26
@shcheklein shcheklein requested a review from skshetry January 25, 2025 21:28
@shcheklein shcheklein marked this pull request as ready for review January 25, 2025 21:41
@shcheklein
Copy link
Member Author

@skshetry PTAL

plots_start_idx = {}
for name, plot in plots.items():
num_points_sent = self._num_points_sent_to_studio.get(name, 0)
plots_to_send[name] = plot[num_points_sent:]
Copy link
Member

Choose a reason for hiding this comment

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

I see below that it did _cast_to_numbers before? Do we need that here?

@shcheklein shcheklein merged commit bf073b9 into main Jan 29, 2025
16 checks passed
@shcheklein shcheklein deleted the fix-858/race-condition-studio-update branch January 29, 2025 17:51
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A: studio Area: Studio integration bug Did we break something?
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants