I am stucked in this part of assignment 2: Week 4 sequential models. The following code takes forver tu run. I keeps running and no result shows up. I have done 4 times already.
Please advis me if there is something wrong with my code. Please provide me with a hint to fix it.
THIS CELL IS NOT EDITABLE
UNIT TEST
def insert_audio_clip_test(target):
np.random.seed(5)
audio_clip, segment_time = target(backgrounds[0], activates[0], [(0, 4400)])
duration = segment_time[1] - segment_time[0] #print(f"xx: {segment_time}“)
assert segment_time[0] > 4400, “Error: The audio clip is overlapping with the first segment”
assert duration + 1 == len(activates[0]) , “The segment length must match the audio clip length”
assert audio_clip != backgrounds[0] , “The audio clip must be different than the pure background”
assert segment_time == (7286, 8201), f"Wrong segment. Expected: (7286, 8201) got:{segment_time}”
# Not possible to insert clip into background
audio_clip, segment_time = target(backgrounds[0], activates[0], [(0, 9999)])
assert segment_time == (10000, 10000), "Segment must match the out by max-retry mark"
assert audio_clip == backgrounds[0], "output audio clip must be exactly the same input background"
print("\033[92m All tests passed!")
As it has been instructed many times throughout the assignments and the course, do not change code where you are not expected to.
Exercise 1:
You had removed the break statement
Exercise 2:
You had removed the retry mechanism put in place to stop from overworking.
You changed the skeleton code provided to you significantly, which was cause of a lot of the problems. You removed the if/else statements, and Step 3 and Step 4 should have been implemented within those statements, but you implemented them outside of it.
Now as you can imagine, all of this and removing the retry mechanism, that is why your code was running for a long long time.
I have fixed the code for you.
Exercise 3:
You removed the if statement. All of the code was supposed to run inside of it.
I’m just going top stop here, you have a lot of other changes made in the assignment as well. Did you copy paste your solutions from some place else ? You have probably used solutions from an older version of the assignment.
Here’s what you need to do
I have corrected your mistakes till exercise 3.
For exercise 4 and 5, I have reset the code back to the original. Please attempt those again.
And again, remember to not change code where you are not expected to.
I’m currently facing the same issue with the assignment regarding the insert_audio_clip_test function. It seems to be taking an excessively long time to run, and I’m not getting any results.
Could you please provide assistance as soon as possible? I would really appreciate any hints or suggestions you might have to help resolve this issue.
I just ran my notebook and it worked fine for me. Everything completed pretty quickly. Are you sure you have not added any infinite loops or the like?
Or the other possibility is that the server that is hosting your VM is very busy right now. You could try logging out and back in again and then running the notebook again.
Note that there is a “while” loop in that logic with a limit of 5 retries. That was given to you in the template code. Are you sure you didn’t modify that logic to remove the retry limit?
Thank you for your response…
I didn’t edit it at all and here is what says
( Learner Error: Grader timed out
Try optimizing the efficiency of your solution
You can visit the Discussion Forums to see if your peers have experienced and found resolutions for similar errors.
What else can you do?
If you are unable to resolve your error in 24 hours, please reach out to Coursera through our [Help Center.])
Note that I successfully solved all the exercises and all test passed except for exercise 2 and I am still getting 0%.
what can I do?
And did you retry a couple of times and it still “hangs” in that same way? If you did, then we’ll need to see your code to figure out what is going on. We can’t do that on a public thread, but please check your DMs for a message from me about how to proceed. Unlike Mubsi, the mentors to not have the superpower to look at someone else’s notebooks.
To close the loop on the public thread, the problem is exactly that the template code was not followed correctly. The logic in insert_audio_clip that terminates the main loop after 5 iterations in the template code was deleted, which results in an infinite loop in one of the tests cases where there is a total overlap and you can’t do the insert.