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.