Skip to content

Conversation

@kerrj
Copy link
Collaborator

@kerrj kerrj commented Oct 16, 2024

There were some crashes in the viewer when the training state was set back to train(), instead of keeping the prior state of the model.

@kerrj kerrj requested a review from brentyi October 16, 2024 20:33
self.viewer.get_model().train()
raise
self.viewer.get_model().train()
if was_training:
Copy link
Collaborator

Choose a reason for hiding this comment

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

we could do:

finally:
    if was_training:
        self.viewer.get_model().train()

and reduce some duplication?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

I don't think this is possible because of the re-raising behavior of the except? is it possible for the finally to run after raising another exception?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh interesting it actually is possible in python, just updated it

Copy link
Collaborator

Choose a reason for hiding this comment

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

oh interesting good point, TIL also!!

@brentyi brentyi merged commit fc4fc5c into main Oct 18, 2024
3 checks passed
@brentyi brentyi deleted the justin/render-train-state branch October 18, 2024 18:38
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.

3 participants