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

Hotfix/speech2song #1036

Merged
merged 3 commits into from
May 28, 2024
Merged

Hotfix/speech2song #1036

merged 3 commits into from
May 28, 2024

Conversation

BeritJanssen
Copy link
Collaborator

This branch hotfixes problems with speech2song: the first_round array didn't have the Explainer as the last object; additionally, there was a problem with the serialization of style: as the next_repeated_representation method generates copies of a Trial, on the second round of serialization, the Playback action within the Trial has already been transformed to a dict, causing an error when calling style.to_dict() again.

Copy link

sentry-io bot commented May 28, 2024

🔍 Existing Issues For Review

Your pull request is modifying functions with the following pre-existing issues:

📄 File: backend/experiment/rules/speech2song.py

Function Unhandled Issue
next_round TypeError: init() got an unexpected keyword argument 'score_message' /server/session/...
Event Count: 1

Did you find this useful? React with a 👍 or 👎

@@ -13,7 +13,8 @@ def action(self):
action_dict = self.__dict__
action_dict['view'] = self.ID

if self.style is not None:
# we may have already converted the style object to a dictionary, e.g., after copying an Action object
Copy link
Contributor

Choose a reason for hiding this comment

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

Just interested: Why could this be converted to a dict already? Shouldn't serialization ideally happen at the end?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Not if we are using copies of the same object, which speech2song does. It makes on Trial object, and from that creates an array of [Trial]*n_representations. As the serialization goes through the list of actions, it will have already converted the Playback's style object to a dict, so in the next step it will attempt to apply the to_dict method again to the style attribute. Took me quite a long time to understand what was going on and why.

@BeritJanssen BeritJanssen merged commit 26c6c31 into main May 28, 2024
7 checks passed
@BeritJanssen BeritJanssen deleted the hotfix/speech2song branch May 28, 2024 09:24
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.

2 participants