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

FP16 not working for CLAP #1465

Open
kyakuno opened this issue Apr 26, 2024 · 1 comment
Open

FP16 not working for CLAP #1465

kyakuno opened this issue Apr 26, 2024 · 1 comment

Comments

@kyakuno
Copy link
Collaborator

kyakuno commented Apr 26, 2024

CLAPのEmbeddingがFP32とFP16で大きな差がある。
確認した上で、FP16を無効化する。

@Belial-public
Copy link

Belial-public commented Apr 26, 2024

Here are 2 examples ran on the same audio file in FP32 vs FP16

VulkanDNN-NVIDIA GeForce RTX 3090 (FP32)

[-0.07167491, 0.0067226873, -0.0072845984, 0.03446939, -0.02426657, 0.02801919, -0.0046428014, -0.0769898, -0.09613554, -0.014845684, -0.06891155, -0.029181072, -0.066582024, -0.026257405, 0.03391587, -0.04982253, -0.028317694, -0.045846336, -0.04388257, -0.0016530197, 0.02253773, -0.003542564, 0.031199152, -0.02841577, 0.01032442, 0.013604545, -0.036384482, 0.06412197, 0.013675574, 0.035730377, -0.007452994, 0.01087719, 0.005901977, 0.030379213, 0.04056858, 0.06570548, -0.008222068, -0.036836177, 0.03141961, 0.010656755, -0.038662143, 0.016911248, 0.07578037, -0.016351318, 0.032906078, 0.018087562, 0.0016143232, -0.002118591, 0.012040993, 0.012359552, -0.016299099, -0.0023279942, 0.039266527, 0.08770768, -0.03532412, 0.044711765, 0.018419357, -0.051313143, -0.030883322, -0.067974076, 0.054751415, 0.02550648, 0.010014709, 0.020031676, -0.012487459, -0.022206912, 0.055116713, 0.040906902, 0.050106872, 0.020171959, 0.07555024, -0.054718386, 0.03652011, -0.029546842, 0.008142047, 0.00251645, 0.055351574, -0.08947506, -0.06555724, 0.02965202, 0.01757757, -0.008344288, -0.009869691, -0.04004567, -0.11727179, 0.03512344, 0.010919628, 0.023864176, -0.07170578, -0.008561397, -0.088314496, -0.031296145, -0.08993769, -0.06043116, 0.049748607, -0.0023823138, -0.06877127, 0.081011906, 0.043657683, -0.032998998, 0.030212857, -0.018827472, -0.050645597, -0.034869358, 0.021177292, -0.029507605, 0.026515888, 0.06826734, 0.056361143, -0.08256553, -0.028698977, 0.0044180416, -0.017072147, -0.04349592, -0.07125589, 0.045168515, 0.04911401, -0.005892691, 0.022052152, 0.046194, -0.013377602, 0.058691174, -0.026868887, 0.006522437, 0.038892522, 0.030437928, -0.027678354, 0.04426096, 0.03665641, -0.09889623, 0.025800625, 0.0050438666, 0.0072027743, -0.029636959, -0.04547692, -0.016886106, 0.048062805, -0.016991127, 0.093823045, -0.044523407, -0.06794799, 0.00083723885, -0.0035421841, -0.009583001, 0.14208455, -0.047800425, -0.022907905, 0.05008231, -0.009102616, 0.074468255, -0.024956943, -0.016037231, 0.009873811, -0.0555358, 0.0428065, -0.037719127, 0.030896338, 0.04249325, -0.030147607, 0.0815631, 0.058419764, -0.030502312, 0.009363375, 0.045420256, -0.01666984, -0.032466564, -0.07527898, -0.025054261, -0.019308245, 0.038718175, -0.017220946, 0.028505638, 0.024717683, -0.08240507, 0.031000564, 0.031689283, 0.011231729, -0.039453465, -0.070828095, -0.033530433, 0.021521216, -0.03718414, -0.046512995, -0.06851721, -0.010904952, 0.05569968, -0.12387649, 0.04739203, -0.027270827, -0.0049529783, -0.019964924, 0.07387821, 0.016889002, 0.018580351, 0.02626802, 0.07104037, 0.021725664, -0.008418759, -0.003280639, -0.018734336, 0.0067534624, 0.05244187, -0.036805645, 0.060413957, -0.030406142, 0.036486253, 0.020789156, -0.060368575, 0.03050123, 0.06774045, 0.030538054, -0.016858302, 0.12367296, -0.017593611, -0.014765885, 0.024942951, -0.07273649, 0.022586444, -0.01409423, 0.048062988, -0.060933903, -0.069777064, -0.012461753, 0.03262471, -0.026313132, -0.001010738, -0.03280853, 0.0029173037, 0.12155854, -0.032154452, -0.10221466, -0.07277938, 0.023195017, -0.012257408, -0.012437272, -0.04639475, 0.049112003, 0.024870493, 0.012700441, -0.052505936, 0.044383734, 6.456867e-05, -0.006192334, 0.05095044, -0.02143116, 0.035985973, 0.0059180018, 0.056985207, -0.030619305, -0.029987376, 0.00457955, -0.032325186, 0.017046383, -0.0037066692, -0.008762466, 0.06423419, -0.08626919, 0.0092558125, 0.056688923, 0.053191725, -0.0049406537, -0.030630983, -0.001238818, -0.018451374, 0.024392892, -0.057347786, -0.014299706, -0.015514252, 0.02732164, -0.029968075, -0.035268202, -0.039295264, -0.013104637, -0.010417483, -0.04800986, -0.047873493, 0.0108253, 0.00511128, -0.010811455, 0.025277399, 0.046229143, 0.01187297, 0.043301925, -0.09696668, 0.042327303, -0.0350964, 0.08012768, 0.027806934, -0.016129598, -0.0006702703, 0.037818033, -0.007786751, 0.06176941, 0.11596614, -0.0791867, 0.018578805, -0.04995599, -0.006857591, 0.026202446, 0.07179141, -0.031552833, 0.049898878, -0.024592983, -0.023458052, 0.04961733, -0.06821436, 0.021215675, -0.030739162, -0.053538002, 0.0063287616, 0.012301986, -0.022791369, -0.012855412, 0.005438703, -0.0030721, 0.036312543, 0.03928301, -0.019400062, 0.09870965, 0.13115284, 0.05276335, -0.036805257, 0.041025274, 0.047960095, -0.05697042, -0.05018129, 0.025827348, -0.016134776, -0.029156867, -0.027787061, 0.032881908, -0.019670242, 0.0073901564, -0.010605693, 0.00040678898, -0.04026159, -0.018707924, 0.074395806, 0.04793274, -0.026202848, -0.1112978, 0.035255242, -0.0592028, 0.02405115, 0.07702957, -0.00036213102, -0.044323172, -0.024300508, -0.04342297, 0.07272247, -0.00149503, 0.0015009346, 0.011537821, 0.03863675, -0.06287203, 0.040654704, 0.037112314, 0.08639332, -0.00023749267, 0.038519286, 0.06540981, 0.006426506, 0.023933347, 0.03827287, 0.05832506, 0.0006061073, -0.035238422, 0.033110328, 0.026657889, -0.09553407, 0.020283917, -0.01357162, 0.046965443, 0.04266149, 0.038022965, -0.012086204, 0.035781324, -0.057193447, -0.016115537, 0.08519238, -0.0031062693, 0.019279175, 0.021941354, -0.001024809, -0.062555365, -0.011224883, -0.054679096, -0.0470384, -0.02976478, 0.007328337, -0.03702643, -0.015361503, -0.03596272, -0.03585825, -0.040092926, -0.039685868, 0.047084335, 0.060467377, -0.0036584528, 0.018467722, -0.05607972, -0.003163293, 0.040889237, 0.022197027, 0.0060607595, 0.07407458, 0.09997841, -0.048814923, 0.07006482, 0.015451471, 0.0030574373, -0.055097565, -0.04061652, -0.052824683, -0.0076775, 0.0019534333, -0.060689934, 0.019139968, 0.0067111896, -0.045252938, -0.031858187, 0.05804718, -0.017926583, -0.060138725, -0.06638011, -0.043388896, -0.0499421, -0.030061515, 0.06308887, -0.054516084, 0.03246851, -0.026114663, -0.07154833, -0.0062474804, -0.036229447, 0.005828205, 0.08327765, -0.037456784, 0.011194476, 0.003568315, -0.11606391, -0.05556279, 0.020529246, -0.013679481, 0.07784176, -0.05187649, -0.0456198, 0.052516773, -0.047423854, -0.05558495, 0.003774234, -0.001769391, -0.04559878, 0.03588822, 0.04835189, 0.005220539, -0.018057412, -0.0025674785, -0.03759291, 0.029193584, 0.033170555, 0.062307272, -0.013824855, 0.030463623, -0.033005442, 0.0049981563, 0.076655015, 0.011424102, -0.092571765, 0.017841863, 0.047377188, 0.028019724, -0.052607343, 0.010072983, 0.043345835, 0.03190055, -0.033937816, 0.017618483, -0.00048038107, -0.012835201, -0.05790036, -0.0034061284, -0.09916822, -0.00046132968, 0.0522807, -0.013352858, -0.031209089, -0.0076609277, 0.017664952, -0.008641052, -0.02095531, -0.020978246, -0.013209749, 0.032997545, 0.01893716, -0.033315632, 0.006965093, -0.042206217, -0.002457571, -0.0015752291, 0.02350271, -0.0037366229, 0.045859005, 0.0060326713, -0.014827626, 0.04618324, -0.043020833, 0.002574976, 0.06814814, 0.054161925, 0.09503905, -0.030981073]

VulkanDNN-NVIDIA GeForce RTX 3090 (FP16)

[-0.017242432, 0.04510498, -0.05697632, 0.046783447, -0.04675293, 0.060699463, -0.005935669, -0.016448975, -0.100097656, -0.060272217, -0.01826477, -0.016830444, -0.011474609, -0.079956055, -0.011802673, -0.03555298, -0.033172607, -0.0256958, -0.08496094, -0.017059326, 0.016799927, -0.09552002, 0.0131073, -0.025512695, -0.08459473, -0.040252686, -0.07470703, 0.048675537, -0.011230469, 0.032836914, 0.061462402, 0.015945435, 0.101745605, -0.0055122375, -0.014732361, 0.053863525, 0.01576233, 0.00018274784, 0.014701843, 0.014778137, -0.03857422, -0.035308838, 0.087402344, -0.045288086, 0.0079574585, 0.016281128, -0.015945435, -0.049194336, -0.016113281, -0.02658081, 0.029434204, -0.0031051636, 0.03692627, 0.008117676, -0.05606079, -0.010643005, 0.030914307, -0.03765869, -0.021072388, -0.01550293, 0.12451172, 0.045654297, 0.08782959, -0.021377563, -0.044921875, -0.0063934326, 0.014045715, -0.016830444, 0.046081543, -0.06689453, 0.014984131, -0.029388428, -0.020965576, 0.0035743713, 0.024734497, -0.019073486, -0.011405945, -0.028869629, -0.016189575, -0.051849365, -0.0003297329, 0.0703125, -0.10357666, -0.01651001, -0.03604126, 0.04034424, -0.025115967, -0.01713562, -0.07788086, 0.021316528, -0.089416504, 0.02218628, 0.008773804, 0.046081543, 0.013191223, -0.039489746, -0.041625977, 0.08270264, -0.009231567, 0.004020691, 0.011100769, -0.04837036, -0.05340576, -0.033050537, 0.031402588, -0.02355957, 0.023590088, 0.049316406, -0.034729004, 0.00491333, 0.00491333, -0.016235352, 0.10583496, 0.008621216, -0.00037789345, -0.04660034, -0.002462387, -0.031402588, 0.013633728, 0.07897949, 0.07287598, -0.015266418, 0.02142334, 0.0146102905, 0.011962891, -0.010948181, -0.017242432, 0.03955078, -0.05340576, -0.022460938, 0.014030457, -0.021743774, -0.014785767, 0.033172607, -0.08874512, -0.019485474, 0.07922363, -0.07220459, 0.055847168, -0.03640747, -0.03857422, -0.03616333, 0.0011854172, 0.011451721, 0.087524414, -0.041107178, 0.04336548, 0.066589355, 0.013587952, 0.057891846, 0.014419556, 0.03591919, -0.03704834, -0.018630981, -0.025024414, 0.018997192, 0.040863037, 0.029464722, -0.070251465, 0.0524292, 0.04458618, 0.08343506, -0.04550171, 0.015731812, 0.045318604, 0.017700195, -0.06817627, -0.02406311, -0.041229248, -0.0047340393, 0.043029785, 0.041900635, 0.020477295, -0.023239136, 0.03387451, -0.019210815, -0.08795166, -0.036102295, -0.07684326, -0.045013428, -0.013328552, 0.017227173, -0.060546875, 0.024963379, 0.07299805, -0.0061912537, -0.053100586, -0.00017786026, 0.008232117, 0.008865356, 0.024337769, 0.008872986, 0.0044136047, -0.025939941, 0.004512787, 0.019500732, -0.006839752, 0.07220459, -0.058654785, -0.01763916, 0.040649414, 0.018936157, -0.022476196, 0.012718201, -0.046966553, -0.040771484, -0.011177063, -0.048858643, -0.058441162, -0.029159546, 0.048339844, -0.12597656, 0.015586853, -0.031234741, -0.039520264, 0.0107421875, 0.0055656433, 0.0016965866, 0.0079956055, 0.047546387, -0.011260986, -0.0113220215, 0.007736206, -0.015853882, 0.009315491, 0.024536133, 0.0059547424, -0.056152344, 0.12365723, -0.013946533, -0.13391113, -0.09777832, 0.09509277, 0.04727173, -0.029220581, -0.06317139, 0.09118652, -0.00014078617, 0.011428833, -0.022964478, -0.028121948, -0.085876465, -0.01713562, 0.048095703, 0.052764893, -0.02949524, 0.015617371, 0.0892334, -0.113464355, -0.0317688, -0.035217285, -0.02999878, -0.04486084, -0.02255249, -0.022583008, 0.020599365, -0.013130188, 0.017608643, -0.0046463013, 0.04196167, 0.043060303, -0.0340271, 0.09338379, -0.05819702, -0.006011963, -0.036865234, -0.014022827, 0.01209259, 0.02267456, -0.006565094, -0.03366089, -0.09411621, 0.007358551, -0.047973633, -0.11260986, 0.03540039, -0.051818848, -0.0524292, 0.0317688, 0.025863647, 0.008049011, 0.032287598, -0.060394287, 0.040893555, -0.017196655, 0.04385376, 0.0055122375, -0.016418457, -0.060180664, -0.021118164, 0.005832672, 0.050476074, 0.008087158, 0.050811768, -0.05090332, 0.008918762, -0.024429321, 0.027816772, 0.011566162, 0.062927246, -0.030700684, 0.027709961, 0.026687622, -0.044311523, 0.013633728, 0.012252808, -6.300211e-05, -0.012924194, -0.024307251, -0.013381958, 0.0848999, -0.012924194, 0.031097412, -0.008163452, -0.014389038, 0.01373291, 0.029632568, -0.04119873, -0.009811401, -0.021331787, 0.018707275, -0.084228516, 0.122802734, 0.06329346, -0.015380859, -0.019714355, 0.03149414, -0.020904541, -0.021865845, 0.013931274, -0.058929443, -0.05709839, -0.021636963, -0.008171082, -0.12451172, 0.06976318, -0.010246277, 0.05895996, 0.04019165, 0.046966553, -0.070373535, 0.030319214, -0.068725586, 0.06262207, -0.056396484, 0.013671875, 0.004047394, -0.050842285, 0.032226562, 0.07910156, 0.024246216, 0.06188965, -0.010612488, -0.00440979, 0.031341553, 0.05215454, 0.07702637, -0.0018415451, -0.0005531311, 0.03640747, 0.061401367, -0.029922485, -0.009292603, 0.034179688, -0.004463196, 0.08148193, -0.00086545944, 0.010520935, 0.041809082, 0.009063721, -0.03579712, -0.056365967, 0.03173828, -0.029891968, 0.101257324, 0.026382446, 0.018676758, 0.005039215, 0.01096344, 0.03189087, -0.01008606, -0.04159546, -0.019866943, 0.011474609, -0.018203735, -0.045532227, -0.05456543, -0.01473999, -0.010124207, 0.03918457, 0.010025024, 0.07714844, 0.023727417, 0.013046265, -0.026168823, -0.05911255, -0.009140015, -0.016036987, 0.02130127, -0.001045227, -0.019622803, 0.027801514, 0.09753418, -0.013954163, 0.011039734, -0.016693115, 0.072021484, -0.033843994, 0.05984497, -0.021194458, 0.021575928, -0.0035743713, -0.024475098, -0.082336426, -0.009750366, 0.019241333, 0.0028038025, -0.04827881, -0.03842163, -0.0054473877, 0.0052375793, -0.008056641, -0.019714355, 0.012886047, -0.047851562, -0.014564514, -0.026855469, 0.016036987, 0.09423828, -0.032714844, 0.033721924, -0.021636963, -0.025253296, -0.05343628, -0.023971558, 0.0027999878, 0.04522705, -0.013053894, 0.01525116, -0.025039673, -0.035736084, -0.03475952, -0.013893127, 0.041900635, 0.10736084, 0.0013065338, 0.018203735, 0.095458984, -0.022918701, -0.0073928833, -0.081604004, 0.010269165, -0.0287323, 0.045715332, 0.03164673, 0.0024738312, 0.07232666, -0.039245605, -0.057373047, 0.06311035, 0.006336212, 0.052825928, -0.08868408, -0.031311035, -0.0051116943, -0.0016965866, 0.088378906, 0.006175995, -0.06512451, 0.015571594, 0.03970337, 0.030883789, -0.061523438, 0.031799316, 0.005973816, 0.0073623657, -0.02507019, -0.02809143, 0.026473999, 0.0012702942, -0.03253174, -0.0101623535, -0.045166016, -0.0602417, 0.054229736, 0.017044067, -0.010154724, -0.060943604, 0.041778564, 0.022857666, 0.008850098, -0.045654297, -0.030639648, 0.06616211, -0.024780273, -0.080078125, 0.042297363, -0.044677734, -0.048187256, 0.04611206, 0.08654785, 0.025131226, -0.013877869, 0.0066108704, 0.028274536, 0.04736328, 0.031921387, -0.0881958, 0.00095939636, -0.009033203, 0.095703125, 0.013015747]

Below is an audio search by similarity

Expected audio search (FP32)
image
Distance should be 0 or close to 0 when searching the same file

Unexpected result with FP16
image

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

2 participants