jdepoix / youtube-transcript-api

This is a python API which allows you to get the transcript/subtitles for a given YouTube video. It also works for automatically generated subtitles and it does not require an API key nor a headless browser, like other selenium based solutions do!
MIT License
2.87k stars 326 forks source link

Incomplete Transcript #173

Closed swap1010 closed 1 year ago

swap1010 commented 1 year ago

When trying to get the Korean transcript and translate it to English for https://www.youtube.com/watch?v=QrzApibhohY Few lines from the end are missing.

jdepoix commented 1 year ago

Hi @swap1010, please add the following information:

swap1010 commented 1 year ago

Executing: transcript_list = YouTubeTranscriptApi.list_transcripts("QrzApibhohY") transcript_list.find_transcript(["ko]).translate("en").fetch() Result: [{'text': 'Gradient checking helped me a lot in saving time and\nfinding bugs in the implementation of backpropagation.', 'start': 0.0, 'duration': 6.46}, {'text': "\nLet's see how it can be done.", 'start': 6.46, 'duration': 8.46}, {'text': '\n', 'start': 14.92, 'duration': 2.51}, {'text': 'We have up to ^[L] So', 'start': 17.43, 'duration': 3.29}, {'text': 'the first thing to check the gradient is to turn these parameters\ninto one big vector θ Transform the', 'start': 20.72, 'duration': 7.96}, {'text': 'matrix W^[1] into a vector Take', 'start': 28.68, 'duration': 6.54}, {'text': 'all the W matrices and turn them into vectors and\nconcatenate them all', 'start': 35.22, 'duration': 6.58}, {'text': 'The result is a very large vector\nparameter θ. Instead of making the', 'start': 41.8, 'duration': 4.86}, {'text': 'cost function J a function of W and b,\nlet it be a function of', 'start': 46.66, 'duration': 6.4}, {'text': 'θ.', 'start': 53.06, 'duration': 2.7}, {'text': '\n', 'start': 58.5, 'duration': 4.06}, {'text': ', make the parameters of db^[1], ... a\nvery large vector dθ it', 'start': 62.56, 'duration': 6.8}, {'text': 'has the same dimensions as θ the', 'start': 69.36, 'duration': 2.98}, {'text': 'same way as before turn dW^[1] into a vector\nand db^[1] is already a vector', 'start': 72.34, 'duration': 6.32}, {'text': 'Every dW is a matrix', 'start': 78.66, 'duration': 3.22}, {'text': 'dW^[1] is the same dimension as W^[1] and', 'start': 81.88, 'duration': 3.18}, {'text': 'db^[1] is the same dimension as b^[1]', 'start': 85.06, 'duration': 2.14}, {'text': 'Resize and concatenate in the same way to make\nall derivatives a very large vector It', 'start': 87.2, 'duration': 8.88}, {'text': 'has the same dimension as θ.', 'start': 96.08, 'duration': 2.76}, {'text': 'The question here is, is dθ the slope of the cost function\nJ(θ)?', 'start': 98.84, 'duration': 8.22}, {'text': "Here's how the gradient check is implemented.\n", 'start': 107.06, 'duration': 5.72}, {'text': '\nIt is a function', 'start': 112.78, 'duration': 5.36}, {'text': 'J(θ)\nmay be expanded', 'start': 118.14, 'duration': 4.54}, {'text': 'to J(θ1, θ2, θ3 ...) J(θ) may be expanded to J(θ1, θ2, θ3 ...)\n', 'start': 122.68, 'duration': 2.9}, {'text': 'Dimensions of a very large parameter vector θ\nIn any case', 'start': 125.58, 'duration': 5.7}, {'text': ', implement an\niteration statement to implement the', 'start': 131.28, 'duration': 4.98}, {'text': 'gradient check', 'start': 136.26, 'duration': 4.34}, {'text': '. I will add ε to\nmove it slightly.', 'start': 153.94, 'duration': 3.88}, {'text': 'Leave everything else as it is and\nadd ε only to θ_i.', 'start': 157.82, 'duration': 4.86}, {'text': 'Since we take the difference on both sides, we', 'start': 162.68, 'duration': 2.82}, {'text': 'do the same for the other side, but we\nwill use θ_i-ε', 'start': 165.5, 'duration': 5.4}, {'text': '.', 'start': 177.72, 'duration': 1.96}, {'text': 'What we saw in the previous video,\nthis value should be approximately equal to', 'start': 179.68, 'duration': 7.42}, {'text': 'dθ[i], which is equal', 'start': 187.1, 'duration': 3.36}, {'text': 'to the partial derivative of function J with respect to\n', 'start': 190.46, 'duration': 6.46}, {'text': 'θ_i, if dθ_i is the derivative of the cost function\nJ. Calculate', 'start': 196.92, 'duration': 4.54}, {'text': 'this value for all values \u200b\u200bof i.\nSo', 'start': 201.46, 'duration': 3.6}, {'text': '\nwe end up doing the calculation with two vectors dθapprox', 'start': 205.06, 'duration': 4.16}, {'text': 'and this is the\nsame dimension', 'start': 212.2, 'duration': 4.08}, {'text': 'as dθ both of these are the\nsame dimension as θ we need to make sure', 'start': 216.28, 'duration': 3.28}, {'text': 'these two vectors are approximately equal\nhow do we define if the', 'start': 219.56, 'duration': 4.5}, {'text': 'two vectors are pretty close\ncan you?', 'start': 224.06, 'duration': 6.98}, {'text': "Let's calculate", 'start': 231.04, 'duration': 1.54}, {'text': 'the Euclidean distance of these two vectors\n', 'start': 232.58, 'duration': 4.76}, {'text': 'dθapprox - Find the\nL2 norm of', 'start': 237.34, 'duration': 2.6}, {'text': 'dθ dθapprox - Find the\nL2 norm of dθ Keep in mind that we', 'start': 239.94, 'duration': 1.58}, {'text': 'are not squaring this value Square\n', 'start': 241.52, 'duration': 2.88}, {'text': 'the difference between these elements to get the Euclidean distance\n', 'start': 244.4, 'duration': 5.52}, {'text': 'Divide by the Euclidean length of ||dθapprox||+ ||dθ|| of', 'start': 254.32, 'duration': 3.26}, {'text': '||dθapprox||+ ||dθ|| to normalize by the', 'start': 257.58, 'duration': 1.48}, {'text': 'length', 'start': 259.06, 'duration': 3.16}, {'text': 'of the vectors\nIn contrast, the', 'start': 262.22, 'duration': 5.92}, {'text': 'denominator turns this equation into a ratio. In', 'start': 268.14, 'duration': 4.76}, {'text': 'practice, I use ε as 10^-7. In\n', 'start': 272.9, 'duration': 5.42}, {'text': 'this range of ε, this formula', 'start': 278.32, 'duration': 5.86}, {'text': 'results in 10^-7 or less, which', 'start': 284.18, 'duration': 4.06}, {'text': '\nmeans that the approximation is very good.', 'start': 288.24, 'duration': 4.98}, {'text': 'Very small values.', 'start': 293.22, 'duration': 2.16}, {'text': "If it's 10^-5, we'll take a closer look.", 'start': 295.38, 'duration': 5.1}, {'text': 'This value will be fine,', 'start': 300.48, 'duration': 1.58}, {'text': "but we'll double-check the elements of the vector to\nmake sure", 'start': 302.06, 'duration': 3.38}, {'text': "there aren't any elements that\n", 'start': 305.44, 'duration': 2.7}, {'text': 'are too large.\n', 'start': 308.14, 'duration': 4.44}, {'text': 'If the formula on the left yields 10^-3,\nit', 'start': 312.58, 'duration': 4.3}, {'text': "'s likely a bug, so\nwe'll look into it", 'start': 316.88, 'duration': 4.9}, {'text': 'further.\n', 'start': 321.78, 'duration': 3.48}, {'text': '\n', 'start': 325.27, 'duration': 4.32}, {'text': 'Then, since there is a high possibility of bugs, we need\n', 'start': 329.59, 'duration': 3.67}, {'text': 'to carefully look at the individual elements of θ and track the value\n', 'start': 333.26, 'duration': 4.6}, {'text': 'of the difference between dθapprox[i] and dθ[i] for a particular i to see if\n', 'start': 337.86, 'duration': 8.46}, {'text': 'there are places where the derivative is not\ncorrect.', 'start': 346.32, 'duration': 4.74}, {'text': "If this\nsmall value comes out after debugging, you've done the", 'start': 351.06, 'duration': 5.92}, {'text': 'right implementation.', 'start': 356.98, 'duration': 2.84}, {'text': 'Therefore\n, if you get a relatively large value in the gradient check when implementing forward propagation or back propagation of the neural network, you', 'start': 359.82, 'duration': 6.04}, {'text': '\n', 'start': 365.86, 'duration': 2.76}, {'text': 'should suspect the possibility of a bug.', 'start': 368.62, 'duration': 1.81}, {'text': 'If the posterior\ngradient check yields small values,', 'start': 370.43, 'duration': 6.44}, {'text': 'feel free to implement\nit.', 'start': 376.87, 'duration': 3.01}, {'text': 'This is how gradient checking\nworks. This is what helped', 'start': 379.88, 'duration': 2.64}, {'text': 'me a lot when implementing a neural network\n', 'start': 382.52, 'duration': 4.46}, {'text': '\n. I will share', 'start': 386.98, 'duration': 7.62}]

Expected Result: [{'text': 'Gradient checking helped me a lot in saving time and\nfinding bugs in the implementation of backpropagation.', 'start': 0.0, 'duration': 6.46}, {'text': "\nLet's see how it can be done.", 'start': 6.46, 'duration': 8.46}, {'text': '\n', 'start': 14.92, 'duration': 2.51}, {'text': 'We have up to ^[L] So', 'start': 17.43, 'duration': 3.29}, {'text': 'the first thing to check the gradient is to turn these parameters\ninto one big vector θ Transform the', 'start': 20.72, 'duration': 7.96}, {'text': 'matrix W^[1] into a vector Take', 'start': 28.68, 'duration': 6.54}, {'text': 'all the W matrices and turn them into vectors and\nconcatenate them all', 'start': 35.22, 'duration': 6.58}, {'text': 'The result is a very large vector\nparameter θ. Instead of making the', 'start': 41.8, 'duration': 4.86}, {'text': 'cost function J a function of W and b,\nlet it be a function of', 'start': 46.66, 'duration': 6.4}, {'text': 'θ.', 'start': 53.06, 'duration': 2.7}, {'text': '\n', 'start': 58.5, 'duration': 4.06}, {'text': ', make the parameters of db^[1], ... a\nvery large vector dθ it', 'start': 62.56, 'duration': 6.8}, {'text': 'has the same dimensions as θ the', 'start': 69.36, 'duration': 2.98}, {'text': 'same way as before turn dW^[1] into a vector\nand db^[1] is already a vector', 'start': 72.34, 'duration': 6.32}, {'text': 'Every dW is a matrix', 'start': 78.66, 'duration': 3.22}, {'text': 'dW^[1] is the same dimension as W^[1] and', 'start': 81.88, 'duration': 3.18}, {'text': 'db^[1] is the same dimension as b^[1]', 'start': 85.06, 'duration': 2.14}, {'text': 'Resize and concatenate in the same way to make\nall derivatives a very large vector It', 'start': 87.2, 'duration': 8.88}, {'text': 'has the same dimension as θ.', 'start': 96.08, 'duration': 2.76}, {'text': 'The question here is, is dθ the slope of the cost function\nJ(θ)?', 'start': 98.84, 'duration': 8.22}, {'text': "Here's how the gradient check is implemented.\n", 'start': 107.06, 'duration': 5.72}, {'text': '\nIt is a function', 'start': 112.78, 'duration': 5.36}, {'text': 'J(θ)\nmay be expanded', 'start': 118.14, 'duration': 4.54}, {'text': 'to J(θ1, θ2, θ3 ...) J(θ) may be expanded to J(θ1, θ2, θ3 ...)\n', 'start': 122.68, 'duration': 2.9}, {'text': 'Dimensions of a very large parameter vector θ\nIn any case', 'start': 125.58, 'duration': 5.7}, {'text': ', implement an\niteration statement to implement the', 'start': 131.28, 'duration': 4.98}, {'text': 'gradient check', 'start': 136.26, 'duration': 4.34}, {'text': '. I will add ε to\nmove it slightly.', 'start': 153.94, 'duration': 3.88}, {'text': 'Leave everything else as it is and\nadd ε only to θ_i.', 'start': 157.82, 'duration': 4.86}, {'text': 'Since we take the difference on both sides, we', 'start': 162.68, 'duration': 2.82}, {'text': 'do the same for the other side, but we\nwill use θ_i-ε', 'start': 165.5, 'duration': 5.4}, {'text': '.', 'start': 177.72, 'duration': 1.96}, {'text': 'What we saw in the previous video,\nthis value should be approximately equal to', 'start': 179.68, 'duration': 7.42}, {'text': 'dθ[i], which is equal', 'start': 187.1, 'duration': 3.36}, {'text': 'to the partial derivative of function J with respect to\n', 'start': 190.46, 'duration': 6.46}, {'text': 'θ_i, if dθ_i is the derivative of the cost function\nJ. Calculate', 'start': 196.92, 'duration': 4.54}, {'text': 'this value for all values \u200b\u200bof i.\nSo', 'start': 201.46, 'duration': 3.6}, {'text': '\nwe end up doing the calculation with two vectors dθapprox', 'start': 205.06, 'duration': 4.16}, {'text': 'and this is the\nsame dimension', 'start': 212.2, 'duration': 4.08}, {'text': 'as dθ both of these are the\nsame dimension as θ we need to make sure', 'start': 216.28, 'duration': 3.28}, {'text': 'these two vectors are approximately equal\nhow do we define if the', 'start': 219.56, 'duration': 4.5}, {'text': 'two vectors are pretty close\ncan you?', 'start': 224.06, 'duration': 6.98}, {'text': "Let's calculate", 'start': 231.04, 'duration': 1.54}, {'text': 'the Euclidean distance of these two vectors\n', 'start': 232.58, 'duration': 4.76}, {'text': 'dθapprox - Find the\nL2 norm of', 'start': 237.34, 'duration': 2.6}, {'text': 'dθ dθapprox - Find the\nL2 norm of dθ Keep in mind that we', 'start': 239.94, 'duration': 1.58}, {'text': 'are not squaring this value Square\n', 'start': 241.52, 'duration': 2.88}, {'text': 'the difference between these elements to get the Euclidean distance\n', 'start': 244.4, 'duration': 5.52}, {'text': 'Divide by the Euclidean length of ||dθapprox||+ ||dθ|| of', 'start': 254.32, 'duration': 3.26}, {'text': '||dθapprox||+ ||dθ|| to normalize by the', 'start': 257.58, 'duration': 1.48}, {'text': 'length', 'start': 259.06, 'duration': 3.16}, {'text': 'of the vectors\nIn contrast, the', 'start': 262.22, 'duration': 5.92}, {'text': 'denominator turns this equation into a ratio. In', 'start': 268.14, 'duration': 4.76}, {'text': 'practice, I use ε as 10^-7. In\n', 'start': 272.9, 'duration': 5.42}, {'text': 'this range of ε, this formula', 'start': 278.32, 'duration': 5.86}, {'text': 'results in 10^-7 or less, which', 'start': 284.18, 'duration': 4.06}, {'text': '\nmeans that the approximation is very good.', 'start': 288.24, 'duration': 4.98}, {'text': 'Very small values.', 'start': 293.22, 'duration': 2.16}, {'text': "If it's 10^-5, we'll take a closer look.", 'start': 295.38, 'duration': 5.1}, {'text': 'This value will be fine,', 'start': 300.48, 'duration': 1.58}, {'text': "but we'll double-check the elements of the vector to\nmake sure", 'start': 302.06, 'duration': 3.38}, {'text': "there aren't any elements that\n", 'start': 305.44, 'duration': 2.7}, {'text': 'are too large.\n', 'start': 308.14, 'duration': 4.44}, {'text': 'If the formula on the left yields 10^-3,\nit', 'start': 312.58, 'duration': 4.3}, {'text': "'s likely a bug, so\nwe'll look into it", 'start': 316.88, 'duration': 4.9}, {'text': 'further.\n', 'start': 321.78, 'duration': 3.48}, {'text': '\n', 'start': 325.27, 'duration': 4.32}, {'text': 'Then, since there is a high possibility of bugs, we need\n', 'start': 329.59, 'duration': 3.67}, {'text': 'to carefully look at the individual elements of θ and track the value\n', 'start': 333.26, 'duration': 4.6}, {'text': 'of the difference between dθapprox[i] and dθ[i] for a particular i to see if\n', 'start': 337.86, 'duration': 8.46}, {'text': 'there are places where the derivative is not\ncorrect.', 'start': 346.32, 'duration': 4.74}, {'text': "If this\nsmall value comes out after debugging, you've done the", 'start': 351.06, 'duration': 5.92}, {'text': 'right implementation.', 'start': 356.98, 'duration': 2.84}, {'text': 'Therefore\n, if you get a relatively large value in the gradient check when implementing forward propagation or back propagation of the neural network, you', 'start': 359.82, 'duration': 6.04}, {'text': '\n', 'start': 365.86, 'duration': 2.76}, {'text': 'should suspect the possibility of a bug.', 'start': 368.62, 'duration': 1.81}, {'text': 'If the posterior\ngradient check yields small values,', 'start': 370.43, 'duration': 6.44}, {'text': 'feel free to implement\nit.', 'start': 376.87, 'duration': 3.01}, {'text': 'This is how gradient checking\nworks. This is what helped', 'start': 379.88, 'duration': 2.64}, {'text': 'me a lot when implementing a neural network\n', 'start': 382.52, 'duration': 4.46}, {'text': '\n. I will share some tips on how to implement a slope check in practice.', 'start': 386.98, 'duration': 7.62}]

Last Line of transcript is missing

jdepoix commented 1 year ago

Why do you think that last line is missing? If I have a look at the Korean transcript the last line is 다음 비디오에서는 실제로 경사 검사를\n구현하는 방법에 대한 팁을 공유드리겠습니다 I do not speak Korean but if I insert this into Google translate it outputs In the next video, I'll share some tips on how to implement a gradient check\nin practice. Which also is the last sentence of the transcript you posted.

This might not be perfectly aligned with what is being said in the video, which could be due to one (or both) of the following reasons:

Is there a specific reason why you are using the korean transcript and translate it into English instead of using the English ASR transcript? I would assume the ASR transcripts to be of much better quality as there isn't as much lost in translation. Also, English generally is the language for which modern ASR models perform the best (due to the abundance of English training data).

Since there I do not see a bug in the module here, I will close this issue, but feel free to further discuss your findings 😊

swap1010 commented 1 year ago

@jdepoix in the transcript i only get "\n. I will share". You saw expected result. Please check the result which i got

jdepoix commented 1 year ago

@swap1010 Oh, I am sorry, you are right! I didn't check the output carefully enough! 🙈 However, I just checked what is returned by YouTube's API and this is the exact output I am getting. So it seems that this is an error on YouTube's end. So there is unfortunately not much we can do about this.

Nonetheless, thank you for reporting! 😊

swap1010 commented 1 year ago

Thanks