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

parselmouth.praat.call stuck in "Change gender" #68

Open
auspicious3000 opened this issue Nov 13, 2021 · 15 comments
Open

parselmouth.praat.call stuck in "Change gender" #68

auspicious3000 opened this issue Nov 13, 2021 · 15 comments

Comments

@auspicious3000
Copy link

Hello,

I have multiple processes of a function calling the parselmouth.praat.call(...). After certain number of iterations, the program hangs forever. Is this because the praat.call() also spawns another subprocess? What would be the recommended way to use praat.call in multiprocessing?

Thanks!

@YannickJadoul
Copy link
Owner

Hi, @auspicious3000!

parselmouth.praat.call is not spawning a new subprocess. It's really just calling into Praat, so I'm surprised this is happening.

But it definitely sounds like a bug, and should not happen. Do you perhaps have a small script that reproduces the problem and that you can share? This way, I could have a hands-on look at the problem.
(If you don't like sharing it publicly on GitHub but do want to share it with me, you could also send me a private email.)

@YannickJadoul
Copy link
Owner

What would be the recommended way to use praat.call in multiprocessing?

Just to be extra clear: in principle, as far as I know, nothing should stop multiprocessing use of praat.call, and I don't know of anything you should do differently that usual.

@auspicious3000
Copy link
Author

After more exploration, I find it does hang forever in some cases, but the cause is not multiprocessing. I will let you know as soon as I find more details. Sorry for the confusion.
So far, the situation is the following:
I was iterating a very large speech dataset using praat.call("change geneder") for each utterance. However, sometimes the praat function raises errors. So I used try and catch to skip those utterances. After a certain number of failures, the function call hangs.

@YannickJadoul
Copy link
Owner

Thank you for the update!

I perfectly understand it's hard to figure out the actual problem, whenever multiprocessing is/was involved :-)
But indeed, you are right that this is still something that should not happen. If you would manage to figure out a (minimal) reproducing example (or anything else that gives more information), I'd be very interested to dig into it and figure out why it hangs. Again, it should not hang, even after a bunch of failures in try-catch statements, so you did find some sort of bug, I think.

@auspicious3000
Copy link
Author

@YannickJadoul I just managed to make a minimal reproducing example. I send it to your email because there is data. Thanks for your help!

@YannickJadoul
Copy link
Owner

@auspicious3000, that's great! Thank you very much; I did gt your email :-) I will see if I can figure out where things go wrong!

@YannickJadoul
Copy link
Owner

So, I already sent @auspicious3000 an email about this, but quickly a summary to get something in the public record of the repository:

@YannickJadoul
Copy link
Owner

This will be fixed in Praat 6.2.02, according to the answer here: praat/praat#1926

I've looked up the fix, and it's in this commit: praat/praat@f8b74b5
Maybe looking into this fix will teach us how to avoid the issue upfront?

I should also start working on Parselmouth 0.5.0, I guess, which will include a new version of Praat and this fix.

@auspicious3000
Copy link
Author

@YannickJadoul That sounds reasonable! Looking forward to the newer version of parselmouth.

@YannickJadoul
Copy link
Owner

YannickJadoul commented Nov 24, 2021

I got confirmation from @auspicious3000 (per email) that the solution proposed here works: praat/praat#1926 (comment); many thanks to @PaulBoersma!

Minor note to add: the Pitch object should be calculated with parselmouth.Sound.to_pitch with time_step argument set to 0.8 / pitch_floor, to exactly match what Praat does inside of the "Change gender" action.

@YannickJadoul
Copy link
Owner

I'll keep this open until we have a next minor Parselmouth release, which will include an update of Praat and the fixes in 6.2.02.

@YannickJadoul YannickJadoul changed the title parselmouth.praat.call stuck in multiprocessing parselmouth.praat.call stuck in "Change gender" Nov 24, 2021
@auspicious3000
Copy link
Author

Should the argument time_step be set to 0.8/pitch_floor ?

@YannickJadoul
Copy link
Owner

Should the argument time_step be set to 0.8/pitch_floor ?

Agh, you're right. I'm very sorry. Too hasty in typing that reply.

I edited the post. Thanks a lot!

@maitycyrus
Copy link

This bug still exists in version 0.4.3. "Change gender" does not throw an exception, it still is caught in an infinite loop.

@YannickJadoul
Copy link
Owner

@maitycyrus, yeah, I still haven't had the time to finish up 0.5.0.
However, Parselmouth's internal Praat version on the latest development version has been updated. So if you urgently need this and don't mind trying out the development version, you can download the wheels from the latest build: https://github.com/YannickJadoul/Parselmouth/actions/runs/3782438748

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

No branches or pull requests

3 participants