{"version":2,"relationshipURLBase":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html","relationshipResolution":"Resolve relative relationship URLs against relationshipURLBase; complete records and absolute URLs are in blocks.","title":"LAB 04 · CLIP：候选、提示与关系检验","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html","markdown":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.md","pages":[{"id":"reading-opening","title":"LAB 04 · CLIP：候选、提示与关系检验","unit":"已知图文配对怎样变成可用的文字候选接口？","unitId":"clip-pairing-to-candidates","chapter":"III","number":1},{"id":"reading-block-49f411cef216497594cb4ab917f97b2f","title":"先做一个无需模型的关系检验","unit":"已知图文配对怎样变成可用的文字候选接口？","unitId":"clip-pairing-to-candidates","chapter":"III","number":2},{"id":"reading-block-2a5577cae28d48a29bceae894948ab01","title":"1 · 图像不变，换文字候选改变了什么？","unit":"已知图文配对怎样变成可用的文字候选接口？","unitId":"clip-pairing-to-candidates","chapter":"III","number":3},{"id":"reading-block-2277d769b3f944bfb8a35fe185c93e32","title":"已保存的真实结果：v16 教师 CPU 推理","unit":"已知图文配对怎样变成可用的文字候选接口？","unitId":"clip-pairing-to-candidates","chapter":"III","number":4},{"id":"reading-block-def6f681ce524dbb9da83aa79032d1c8","title":"2 · 独立准备并核对预处理","unit":"已知图文配对怎样变成可用的文字候选接口？","unitId":"clip-pairing-to-candidates","chapter":"III","number":5},{"id":"reading-block-7203294161d5450497543d518d80ed6d","title":"3 · 可选：固定模型，重算四个候选条件","unit":"已知图文配对怎样变成可用的文字候选接口？","unitId":"clip-pairing-to-candidates","chapter":"III","number":6},{"id":"reading-block-30b2d43a6e3247dbace306ecfe1c52bb","title":"4 · 只改一个条件","unit":"已知图文配对怎样变成可用的文字候选接口？","unitId":"clip-pairing-to-candidates","chapter":"III","number":7},{"id":"reading-block-4f42285447374de387bf748b74f29f7f","title":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","unit":"已知图文配对怎样变成可用的文字候选接口？","unitId":"clip-pairing-to-candidates","chapter":"III","number":8},{"id":"reading-block-e8d09daa81304bbebf6af1b6be1d73f0","title":"预处理和两条编码支路到底做了什么？","unit":"已知图文配对怎样变成可用的文字候选接口？","unitId":"clip-pairing-to-candidates","chapter":"III","number":9},{"id":"reading-block-fe69124edb824641b98df3d509006d26","title":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","unit":"已知图文配对怎样变成可用的文字候选接口？","unitId":"clip-pairing-to-candidates","chapter":"III","number":10},{"id":"reading-block-1cff4428a5f343258064d92cb3ab303d","title":"下一步：同一批真实向量怎样变成检索系统？","unit":"已知图文配对怎样变成可用的文字候选接口？","unitId":"clip-pairing-to-candidates","chapter":"III","number":11}],"aliases":[{"oldId":"b-a59caeec9cdca5de332ef82a","targetId":"b-a59caeec9cdca5de332ef82a","page":"reading-opening","operation":"move","beforeSHA256":"ae7c40abec94303488a281999e287abd93b9f9a7acaf51d8616da6ff80f3b9a8","afterSHA256":"ae7c40abec94303488a281999e287abd93b9f9a7acaf51d8616da6ff80f3b9a8","reason":"Same source body in authored semantic page"},{"oldId":"b-a1203c01e71c0432974dfbcd","targetId":"b-a1203c01e71c0432974dfbcd","page":"reading-opening","operation":"move","beforeSHA256":"42cba31deccba2a350b9b23bd0ca1dcaa4c4c5cb9d35c773e1fcb89124788ccd","afterSHA256":"42cba31deccba2a350b9b23bd0ca1dcaa4c4c5cb9d35c773e1fcb89124788ccd","reason":"Same source body in authored semantic page"},{"oldId":"b-b5bf41e3a0647846d8a53661","targetId":"b-b5bf41e3a0647846d8a53661","page":"reading-opening","operation":"move","beforeSHA256":"90e8ba62b9af4bedd5be3a2559568519f4df7a42b13048f81039496efd45dea2","afterSHA256":"90e8ba62b9af4bedd5be3a2559568519f4df7a42b13048f81039496efd45dea2","reason":"Same source body in authored semantic page"},{"oldId":"b-d0363b2ec3173c04fa1662cd","targetId":"b-d0363b2ec3173c04fa1662cd","page":"reading-opening","operation":"move","beforeSHA256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","afterSHA256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","reason":"Same source body in authored semantic page"},{"oldId":"b-e91f15940932f6063f3e37ab","targetId":"b-e91f15940932f6063f3e37ab","page":"reading-opening","operation":"move","beforeSHA256":"bab4bd804571aa5afbaf197e9c1539510fc766578c9825aa46cadbb18444cc32","afterSHA256":"bab4bd804571aa5afbaf197e9c1539510fc766578c9825aa46cadbb18444cc32","reason":"Same source body in authored semantic page"},{"oldId":"b-086faa9d2594c28492e778ac","targetId":"b-086faa9d2594c28492e778ac","page":"reading-opening","operation":"move","beforeSHA256":"17eb4c37b11d5afe331c6db83817582dd19a2360d19a42934f22620d3efc34f8","afterSHA256":"17eb4c37b11d5afe331c6db83817582dd19a2360d19a42934f22620d3efc34f8","reason":"Same source body in authored semantic page"},{"oldId":"b-96b7e678460cf1fb4b7b60d7","targetId":"b-96b7e678460cf1fb4b7b60d7","page":"reading-opening","operation":"move","beforeSHA256":"7cb69821f69a051b3852548284305c334f86d24891322c1f75467877151f8d0c","afterSHA256":"7cb69821f69a051b3852548284305c334f86d24891322c1f75467877151f8d0c","reason":"Same source body in authored semantic page"},{"oldId":"b-c0a05fb017484d91c11a8281","targetId":"b-c0a05fb017484d91c11a8281","page":"reading-opening","operation":"move","beforeSHA256":"2739e67308cfdf38b94e3f702cb12b8ad07b1a4c9b828e79fa591fcc5181faff","afterSHA256":"2739e67308cfdf38b94e3f702cb12b8ad07b1a4c9b828e79fa591fcc5181faff","reason":"Same source body in authored semantic page"},{"oldId":"b-0023f17af8ab3853b5a8b9f4","targetId":"b-0023f17af8ab3853b5a8b9f4","page":"reading-opening","operation":"move","beforeSHA256":"e413a378e31c7f5c9e110f8a97a90c647c8b36cdca962006ec630adc29a414ff","afterSHA256":"e413a378e31c7f5c9e110f8a97a90c647c8b36cdca962006ec630adc29a414ff","reason":"Same source body in authored semantic page"},{"oldId":"b-a3c655b55da3a051a9a89cb2","targetId":"b-a3c655b55da3a051a9a89cb2","page":"reading-block-49f411cef216497594cb4ab917f97b2f","operation":"move","beforeSHA256":"ac9101f564470c682fd7f7fc46f6980ebd397445e3a0baa029d1ff240079176d","afterSHA256":"ac9101f564470c682fd7f7fc46f6980ebd397445e3a0baa029d1ff240079176d","reason":"Same source body in authored semantic page"},{"oldId":"b-eb82be40a9fef6046057996c","targetId":"b-eb82be40a9fef6046057996c","page":"reading-block-49f411cef216497594cb4ab917f97b2f","operation":"move","beforeSHA256":"a3d6b0b3480b9dd8f638525099e38b5aa94a4ecd0715d954046e4379bd07cca9","afterSHA256":"a3d6b0b3480b9dd8f638525099e38b5aa94a4ecd0715d954046e4379bd07cca9","reason":"Same source body in authored semantic page"},{"oldId":"b-025421f0f8119aef9de3208e","targetId":"b-025421f0f8119aef9de3208e","page":"reading-block-49f411cef216497594cb4ab917f97b2f","operation":"move","beforeSHA256":"002ee180ca7d8b372df681eb1b2b825f74f69a045e7f69aefa8b7dbdb04e0676","afterSHA256":"002ee180ca7d8b372df681eb1b2b825f74f69a045e7f69aefa8b7dbdb04e0676","reason":"Same source body in authored semantic page"},{"oldId":"b-2a978113bd3539e024bf35f9","targetId":"b-2a978113bd3539e024bf35f9","page":"reading-block-49f411cef216497594cb4ab917f97b2f","operation":"move","beforeSHA256":"eff7bd92a5815c6392c5337752565d07dbb033bd592078e262f85208f537b28f","afterSHA256":"eff7bd92a5815c6392c5337752565d07dbb033bd592078e262f85208f537b28f","reason":"Same source body in authored semantic page"},{"oldId":"b-b6eef90132caf12132b49c03","targetId":"b-b6eef90132caf12132b49c03","page":"reading-block-49f411cef216497594cb4ab917f97b2f","operation":"rewrite","beforeSHA256":"62b5cdcc3bcc4579fdaff13e252920f3fe7110f06c3bfd93930a38d250695cc5","afterSHA256":"9bacd479447d1472924103d646683567689bca6262b8ef5039014313bcb7e44b","reason":"Same source identity with figure semantics or reading context enriched"},{"oldId":"b-0e353d81c506f83d28a7508f","targetId":"b-0e353d81c506f83d28a7508f","page":"reading-block-49f411cef216497594cb4ab917f97b2f","operation":"rewrite","beforeSHA256":"650a59736059146d5091c3456c7f6d26f1a06a5725281a0d79567655c3f951e0","afterSHA256":"1e78fc525a8f547a5c4ad3030ff12f86307c3912c6f56f2a1f8883efc024cc4a","reason":"Same source identity with figure semantics or reading context enriched"},{"oldId":"b-b92f4ebf3088e5c3f44e65e1","targetId":"b-b92f4ebf3088e5c3f44e65e1","page":"reading-block-49f411cef216497594cb4ab917f97b2f","operation":"move","beforeSHA256":"8dd803defe959aafbe275233401562ad3c7e5d046d7244df78326c946ddec48a","afterSHA256":"8dd803defe959aafbe275233401562ad3c7e5d046d7244df78326c946ddec48a","reason":"Same source body in authored semantic page"},{"oldId":"b-0440ed645a50f20292a71fe4","targetId":"b-0440ed645a50f20292a71fe4","page":"reading-block-49f411cef216497594cb4ab917f97b2f","operation":"move","beforeSHA256":"3628eb0bcd27fe1e82d4e90dac3a0c44ae048ebf06483616967c8a9fa285f320","afterSHA256":"3628eb0bcd27fe1e82d4e90dac3a0c44ae048ebf06483616967c8a9fa285f320","reason":"Same source body in authored semantic page"},{"oldId":"b-e1f28cc4a760b2b10995f250","targetId":"b-e1f28cc4a760b2b10995f250","page":"reading-block-49f411cef216497594cb4ab917f97b2f","operation":"move","beforeSHA256":"abdc1a7d771aeebf9025a397b0951fd408f0d98959a528ef50dfe9d6db7ec644","afterSHA256":"abdc1a7d771aeebf9025a397b0951fd408f0d98959a528ef50dfe9d6db7ec644","reason":"Same source body in authored semantic page"},{"oldId":"b-a88f96e4b5c2df2747f153a1","targetId":"b-a88f96e4b5c2df2747f153a1","page":"reading-block-49f411cef216497594cb4ab917f97b2f","operation":"move","beforeSHA256":"9a9baebeb838798aee785b3281a47bc49464072d063ab2e9a336bb823028f544","afterSHA256":"9a9baebeb838798aee785b3281a47bc49464072d063ab2e9a336bb823028f544","reason":"Same source body in authored semantic page"},{"oldId":"b-bd65196c031894682b2ab8b1","targetId":"b-bd65196c031894682b2ab8b1","page":"reading-block-49f411cef216497594cb4ab917f97b2f","operation":"move","beforeSHA256":"6af71429e89201825c75c19463619eead112b42aab01c27cfb2a622bbed03021","afterSHA256":"6af71429e89201825c75c19463619eead112b42aab01c27cfb2a622bbed03021","reason":"Same source body in authored semantic page"},{"oldId":"b-e654f90a5e895aad3db158b7","targetId":"b-e654f90a5e895aad3db158b7","page":"reading-block-49f411cef216497594cb4ab917f97b2f","operation":"rewrite","beforeSHA256":"ab755784e37998f89606a65748fde407c22530cf4001cdc6eeca300c5f896c1b","afterSHA256":"52d0d0032a15d84c465719b1bba9c90592f9709384a91537cba344375c310ce0","reason":"Same source identity with figure semantics or reading context enriched"},{"oldId":"b-86406523dc6c9dc8f5bf979d","targetId":"b-86406523dc6c9dc8f5bf979d","page":"reading-block-49f411cef216497594cb4ab917f97b2f","operation":"move","beforeSHA256":"2f622a9fa22527aa604d1e937d6beb9c67c02ae7e6ff106b26fca7a92616efcb","afterSHA256":"2f622a9fa22527aa604d1e937d6beb9c67c02ae7e6ff106b26fca7a92616efcb","reason":"Same source body in authored semantic page"},{"oldId":"b-a91d8a63a5c265d25c64fd2f","targetId":"b-a91d8a63a5c265d25c64fd2f","page":"reading-block-49f411cef216497594cb4ab917f97b2f","operation":"move","beforeSHA256":"c74240826351f9ed7a36ac6cd17bdc1384a79161fff35eb05cd6cfb8abdb1ab1","afterSHA256":"c74240826351f9ed7a36ac6cd17bdc1384a79161fff35eb05cd6cfb8abdb1ab1","reason":"Same source body in authored semantic page"},{"oldId":"b-3126dfb7647cb23c4a6fa9a8","targetId":"b-3126dfb7647cb23c4a6fa9a8","page":"reading-block-2a5577cae28d48a29bceae894948ab01","operation":"move","beforeSHA256":"dba7baea294bf7c0a8fc38bb9dbe4e885f17f0d5d3f416485c1a2a744a11a944","afterSHA256":"dba7baea294bf7c0a8fc38bb9dbe4e885f17f0d5d3f416485c1a2a744a11a944","reason":"Same source body in authored semantic page"},{"oldId":"b-7e0475d2aea39df2f333c5bc","targetId":"b-7e0475d2aea39df2f333c5bc","page":"reading-block-2a5577cae28d48a29bceae894948ab01","operation":"move","beforeSHA256":"696a7a68b46eba274aa0f56872a9de8a7ba799867870737a10d37d76c46ccb0f","afterSHA256":"696a7a68b46eba274aa0f56872a9de8a7ba799867870737a10d37d76c46ccb0f","reason":"Same source body in authored semantic page"},{"oldId":"b-60ffe34842c91700f2590407","targetId":"b-60ffe34842c91700f2590407","page":"reading-block-2a5577cae28d48a29bceae894948ab01","operation":"move","beforeSHA256":"afdaa6ba5eb44248015c0abeff985f0fc8bc483483ce7ddeea53ad3887481e04","afterSHA256":"afdaa6ba5eb44248015c0abeff985f0fc8bc483483ce7ddeea53ad3887481e04","reason":"Same source body in authored semantic page"},{"oldId":"b-45025d34087a8968a6bf2419","targetId":"b-45025d34087a8968a6bf2419","page":"reading-block-2a5577cae28d48a29bceae894948ab01","operation":"rewrite","beforeSHA256":"7dbe7eb567d1a10a6f6340504e838057565a390c6dd8dacb38bee82169ce669b","afterSHA256":"bf0e8263b3b3471fd1bb36c67d008e4fcda92a38a04a927196d2f8c4312012a1","reason":"Same source identity with figure semantics or reading context enriched"},{"oldId":"b-7e360719307351da14bb607c","targetId":"b-7e360719307351da14bb607c","page":"reading-block-2a5577cae28d48a29bceae894948ab01","operation":"move","beforeSHA256":"2e8df714b4e26523424479430c4106c4ae2cc9a32f1a91c79201e1ceb0b03a25","afterSHA256":"2e8df714b4e26523424479430c4106c4ae2cc9a32f1a91c79201e1ceb0b03a25","reason":"Same source body in authored semantic page"},{"oldId":"b-948e95e440d2bc0333245546","targetId":"b-948e95e440d2bc0333245546","page":"reading-block-2a5577cae28d48a29bceae894948ab01","operation":"move","beforeSHA256":"185518c84d3d21a139f9f2a07beeb350c944048a8275369319217304556c74fc","afterSHA256":"185518c84d3d21a139f9f2a07beeb350c944048a8275369319217304556c74fc","reason":"Same source body in authored semantic page"},{"oldId":"b-6bafbc73a59a2eeca2087b9d","targetId":"b-6bafbc73a59a2eeca2087b9d","page":"reading-block-2a5577cae28d48a29bceae894948ab01","operation":"move","beforeSHA256":"e1bbf303cd2f3a9fb0d5bb00b4e0bdd572b9d381dda48a5c44776a801b038d2f","afterSHA256":"e1bbf303cd2f3a9fb0d5bb00b4e0bdd572b9d381dda48a5c44776a801b038d2f","reason":"Same source body in authored semantic page"},{"oldId":"b-04eb1c391bdbf46622c8b10a","targetId":"b-04eb1c391bdbf46622c8b10a","page":"reading-block-2a5577cae28d48a29bceae894948ab01","operation":"move","beforeSHA256":"19d12afe8e40a8cf7b89ad4289b1455d25d83acb8179520486bf113ae38dcb13","afterSHA256":"19d12afe8e40a8cf7b89ad4289b1455d25d83acb8179520486bf113ae38dcb13","reason":"Same source body in authored semantic page"},{"oldId":"b-f83c06e30511cf60ea488ef2","targetId":"b-f83c06e30511cf60ea488ef2","page":"reading-block-2277d769b3f944bfb8a35fe185c93e32","operation":"move","beforeSHA256":"b45eb5d03b596bf0c2b4cb6e66e1a268efcf18ae5fcbbd73265263da940613c0","afterSHA256":"b45eb5d03b596bf0c2b4cb6e66e1a268efcf18ae5fcbbd73265263da940613c0","reason":"Same source body in authored semantic page"},{"oldId":"b-4dfc7ff6e17d4bb63aac9239","targetId":"b-4dfc7ff6e17d4bb63aac9239","page":"reading-block-2277d769b3f944bfb8a35fe185c93e32","operation":"move","beforeSHA256":"c85985cd5331e0560a38087c007fc3216d1a1846e79d4da462f86ebc99cfbd92","afterSHA256":"c85985cd5331e0560a38087c007fc3216d1a1846e79d4da462f86ebc99cfbd92","reason":"Same source body in authored semantic page"},{"oldId":"b-5f002549bdef4f3350690cbb","targetId":"b-5f002549bdef4f3350690cbb","page":"reading-block-2277d769b3f944bfb8a35fe185c93e32","operation":"move","beforeSHA256":"5f79e41ca232ac604cb970774ef9f76a07eccf3200ad399c864f4b7a88904a70","afterSHA256":"a71426d4749e4a541ba3dcf2296584e8cae0de1144f80b417b32abf8dc516bdc","reason":"Same source body in authored semantic page"},{"oldId":"b-1c9eb656f885ff60c93e792d","targetId":"b-1c9eb656f885ff60c93e792d","page":"reading-block-2277d769b3f944bfb8a35fe185c93e32","operation":"rewrite","beforeSHA256":"4f27a979efb63e64dbb874e25443c4e9550aab1e6a24f6d0fd1bce46bd77bf23","afterSHA256":"16d60412e009518b71d22e38b03af09a6a6aafe19dedb059ebc1c7aedca9e6d8","reason":"Same source identity with figure semantics or reading context enriched"},{"oldId":"b-649b822d2f50270f5881eccc","targetId":"b-649b822d2f50270f5881eccc","page":"reading-block-2277d769b3f944bfb8a35fe185c93e32","operation":"move","beforeSHA256":"e846288e93259db28b01faa8fceb24f1c74b09dd8638a751a17f2f0b9c8af72a","afterSHA256":"e846288e93259db28b01faa8fceb24f1c74b09dd8638a751a17f2f0b9c8af72a","reason":"Same source body in authored semantic page"},{"oldId":"b-6691a622402ba67dbbd730b2","targetId":"b-6691a622402ba67dbbd730b2","page":"reading-block-def6f681ce524dbb9da83aa79032d1c8","operation":"move","beforeSHA256":"1460e216a61fc6c392935c52cbe27c9f5ed079ac2c8e974d85ae0fb0ebbd7466","afterSHA256":"1460e216a61fc6c392935c52cbe27c9f5ed079ac2c8e974d85ae0fb0ebbd7466","reason":"Same source body in authored semantic page"},{"oldId":"b-bfc7a5c826ee8ed2bafc8f06","targetId":"b-bfc7a5c826ee8ed2bafc8f06","page":"reading-block-def6f681ce524dbb9da83aa79032d1c8","operation":"move","beforeSHA256":"3c284f394e9da76c043b0ce26f0de75b6a6c01df6c3ed6856cb5b48d7072ec20","afterSHA256":"3c284f394e9da76c043b0ce26f0de75b6a6c01df6c3ed6856cb5b48d7072ec20","reason":"Same source body in authored semantic page"},{"oldId":"b-5d04f9519470deb6dc1abb4a","targetId":"b-5d04f9519470deb6dc1abb4a","page":"reading-block-def6f681ce524dbb9da83aa79032d1c8","operation":"move","beforeSHA256":"b49cd167f2cd93fe7431aea28959a8acf1559bfe30fb63d65ca0078b3ba9b785","afterSHA256":"b49cd167f2cd93fe7431aea28959a8acf1559bfe30fb63d65ca0078b3ba9b785","reason":"Same source body in authored semantic page"},{"oldId":"b-033489d7b7cdd39d6e69d075","targetId":"b-033489d7b7cdd39d6e69d075","page":"reading-block-def6f681ce524dbb9da83aa79032d1c8","operation":"move","beforeSHA256":"299dde2261afc779a24cf1ae75d95db124c4172bdc20f07be698f22dadfa7947","afterSHA256":"299dde2261afc779a24cf1ae75d95db124c4172bdc20f07be698f22dadfa7947","reason":"Same source body in authored semantic page"},{"oldId":"b-f2b2d8417c6958fcb1086832","targetId":"b-f2b2d8417c6958fcb1086832","page":"reading-block-def6f681ce524dbb9da83aa79032d1c8","operation":"move","beforeSHA256":"dff19488e6f8888405f2823c59d4a3766072b0b85e025b7f28149516e0dfd52d","afterSHA256":"dff19488e6f8888405f2823c59d4a3766072b0b85e025b7f28149516e0dfd52d","reason":"Same source body in authored semantic page"},{"oldId":"b-f7bc425e4c52c19843051680","targetId":"b-f7bc425e4c52c19843051680","page":"reading-block-7203294161d5450497543d518d80ed6d","operation":"move","beforeSHA256":"6def08c32b253314741f0d8207cc72a2de517cdf2ede4ebf2bd41c9b12b36fd4","afterSHA256":"6def08c32b253314741f0d8207cc72a2de517cdf2ede4ebf2bd41c9b12b36fd4","reason":"Same source body in authored semantic page"},{"oldId":"b-8d8bf785574c000b4391ac04","targetId":"b-8d8bf785574c000b4391ac04","page":"reading-block-7203294161d5450497543d518d80ed6d","operation":"move","beforeSHA256":"8e747f8fbed7789631a4090e72c711a840e333ac2f73d4e3552fb97b9d603122","afterSHA256":"8e747f8fbed7789631a4090e72c711a840e333ac2f73d4e3552fb97b9d603122","reason":"Same source body in authored semantic page"},{"oldId":"b-8f9af9d2c59465556fcfcdbc","targetId":"b-8f9af9d2c59465556fcfcdbc","page":"reading-block-7203294161d5450497543d518d80ed6d","operation":"move","beforeSHA256":"230d2735d75681058289c5ed8cba5733565164e34ad5d90cb2ee8331665da334","afterSHA256":"230d2735d75681058289c5ed8cba5733565164e34ad5d90cb2ee8331665da334","reason":"Same source body in authored semantic page"},{"oldId":"b-351ab093f0c04304382d755e","targetId":"b-351ab093f0c04304382d755e","page":"reading-block-7203294161d5450497543d518d80ed6d","operation":"move","beforeSHA256":"299dde2261afc779a24cf1ae75d95db124c4172bdc20f07be698f22dadfa7947","afterSHA256":"299dde2261afc779a24cf1ae75d95db124c4172bdc20f07be698f22dadfa7947","reason":"Same source body in authored semantic page"},{"oldId":"b-381503e1bb93bb474863c1c8","targetId":"b-381503e1bb93bb474863c1c8","page":"reading-block-7203294161d5450497543d518d80ed6d","operation":"move","beforeSHA256":"153cee9f8061cd6424bc0699b4d904c6769236d684d0590ad42ba59aa6f46ce4","afterSHA256":"153cee9f8061cd6424bc0699b4d904c6769236d684d0590ad42ba59aa6f46ce4","reason":"Same source body in authored semantic page"},{"oldId":"b-8bbab072b41ee812211fc13d","targetId":"b-8bbab072b41ee812211fc13d","page":"reading-block-30b2d43a6e3247dbace306ecfe1c52bb","operation":"move","beforeSHA256":"fceca1c52ec155a2f29246eebfe581d3fbb61de9458ca8c59f36e5371c093541","afterSHA256":"fceca1c52ec155a2f29246eebfe581d3fbb61de9458ca8c59f36e5371c093541","reason":"Same source body in authored semantic page"},{"oldId":"b-9ec66450d66b9b5b6e69849d","targetId":"b-9ec66450d66b9b5b6e69849d","page":"reading-block-30b2d43a6e3247dbace306ecfe1c52bb","operation":"move","beforeSHA256":"9745219605a12e01d5aa422c63970dcc27eb1501f1d73625b63f31e6e3a7f277","afterSHA256":"9745219605a12e01d5aa422c63970dcc27eb1501f1d73625b63f31e6e3a7f277","reason":"Same source body in authored semantic page"},{"oldId":"b-c8ac033032bd0d789d99afd8","targetId":"b-c8ac033032bd0d789d99afd8","page":"reading-block-30b2d43a6e3247dbace306ecfe1c52bb","operation":"move","beforeSHA256":"c1def692c27ca829d3649ef30205720c238b601dbc08d56678be2cfd3d76e4e1","afterSHA256":"c1def692c27ca829d3649ef30205720c238b601dbc08d56678be2cfd3d76e4e1","reason":"Same source body in authored semantic page"},{"oldId":"b-8bae31ae56e65bb31620f9d0","targetId":"b-8bae31ae56e65bb31620f9d0","page":"reading-block-30b2d43a6e3247dbace306ecfe1c52bb","operation":"move","beforeSHA256":"4de0e67d674b8d4e079a576c58ad3e7b5657a86ff8f83fab386dc93cb39911ee","afterSHA256":"4de0e67d674b8d4e079a576c58ad3e7b5657a86ff8f83fab386dc93cb39911ee","reason":"Same source body in authored semantic page"},{"oldId":"b-eb0025b322d1a43d9bc45fd4","targetId":"b-eb0025b322d1a43d9bc45fd4","page":"reading-block-30b2d43a6e3247dbace306ecfe1c52bb","operation":"move","beforeSHA256":"299dde2261afc779a24cf1ae75d95db124c4172bdc20f07be698f22dadfa7947","afterSHA256":"299dde2261afc779a24cf1ae75d95db124c4172bdc20f07be698f22dadfa7947","reason":"Same source body in authored semantic page"},{"oldId":"b-4ba01b4b2724768b71ec1a8f","targetId":"b-4ba01b4b2724768b71ec1a8f","page":"reading-block-30b2d43a6e3247dbace306ecfe1c52bb","operation":"move","beforeSHA256":"09ae1a67c6c83e255ec18e1aaa206c29f2382c975316158db8241fc238d797d0","afterSHA256":"09ae1a67c6c83e255ec18e1aaa206c29f2382c975316158db8241fc238d797d0","reason":"Same source body in authored semantic page"},{"oldId":"b-a27e876fed1f0765d4e4d354","targetId":"b-a27e876fed1f0765d4e4d354","page":"reading-block-4f42285447374de387bf748b74f29f7f","operation":"move","beforeSHA256":"f21fd442d22569deda7beed517ab481920302a21cbd52139c0ba858e0015d97a","afterSHA256":"f21fd442d22569deda7beed517ab481920302a21cbd52139c0ba858e0015d97a","reason":"Same source body in authored semantic page"},{"oldId":"b-ee7152cf526695e7efa9a46f","targetId":"b-ee7152cf526695e7efa9a46f","page":"reading-block-4f42285447374de387bf748b74f29f7f","operation":"move","beforeSHA256":"e85f736391eb22f95851f32279f2e9d6cc466bb40e5e7001fe48a832b093af91","afterSHA256":"e85f736391eb22f95851f32279f2e9d6cc466bb40e5e7001fe48a832b093af91","reason":"Same source body in authored semantic page"},{"oldId":"b-aac40eaa877e5720f8bd850c","targetId":"b-aac40eaa877e5720f8bd850c","page":"reading-block-4f42285447374de387bf748b74f29f7f","operation":"move","beforeSHA256":"560e1ce7de2f6d5a82f207259d27b2235296af34df0fb4edb840762408393593","afterSHA256":"560e1ce7de2f6d5a82f207259d27b2235296af34df0fb4edb840762408393593","reason":"Same source body in authored semantic page"},{"oldId":"b-e4c4bb9bc4745a40850c8549","targetId":"b-e4c4bb9bc4745a40850c8549","page":"reading-block-4f42285447374de387bf748b74f29f7f","operation":"move","beforeSHA256":"8c0fd90086274679639f315bfd72e859819f0499ec7a8edfbf076c7e9f007774","afterSHA256":"8c0fd90086274679639f315bfd72e859819f0499ec7a8edfbf076c7e9f007774","reason":"Same source body in authored semantic page"},{"oldId":"b-60a3cf2a1a6a9fd5bbd8f01e","targetId":"b-60a3cf2a1a6a9fd5bbd8f01e","page":"reading-block-4f42285447374de387bf748b74f29f7f","operation":"move","beforeSHA256":"3d32c29794a1b985da1ce28a5c69a139c3d4040422600609c15a1f81f9536114","afterSHA256":"3d32c29794a1b985da1ce28a5c69a139c3d4040422600609c15a1f81f9536114","reason":"Same source body in authored semantic page"},{"oldId":"b-719e26a4931ee20702889e9e","targetId":"b-719e26a4931ee20702889e9e","page":"reading-block-e8d09daa81304bbebf6af1b6be1d73f0","operation":"move","beforeSHA256":"4227d215a5365c216c591d138650d0074d422406d52d369b938da2510c55ecb8","afterSHA256":"4227d215a5365c216c591d138650d0074d422406d52d369b938da2510c55ecb8","reason":"Same source body in authored semantic page"},{"oldId":"b-a009ac66ccd160075a3ca3ea","targetId":"b-a009ac66ccd160075a3ca3ea","page":"reading-block-e8d09daa81304bbebf6af1b6be1d73f0","operation":"move","beforeSHA256":"551b29c91d6c2e964eb6f0864175d1a3cae486550e57203367929de82204e36d","afterSHA256":"551b29c91d6c2e964eb6f0864175d1a3cae486550e57203367929de82204e36d","reason":"Same source body in authored semantic page"},{"oldId":"b-fd359739b0bf453286709c4f","targetId":"b-fd359739b0bf453286709c4f","page":"reading-block-e8d09daa81304bbebf6af1b6be1d73f0","operation":"move","beforeSHA256":"59d972b7a7945ded7b62c614dc541e82d259c17a4b3cd968a54d03da8a101b7f","afterSHA256":"59d972b7a7945ded7b62c614dc541e82d259c17a4b3cd968a54d03da8a101b7f","reason":"Same source body in authored semantic page"},{"oldId":"b-b8d587d101a885711626d9a7","targetId":"b-b8d587d101a885711626d9a7","page":"reading-block-e8d09daa81304bbebf6af1b6be1d73f0","operation":"move","beforeSHA256":"99beb2d6a5d9904ce69adb41cd2bf80d59594073ae2fbc7002054d338eb7ed7a","afterSHA256":"99beb2d6a5d9904ce69adb41cd2bf80d59594073ae2fbc7002054d338eb7ed7a","reason":"Same source body in authored semantic page"},{"oldId":"b-29c638a5c2a90165a0a30fc9","targetId":"b-29c638a5c2a90165a0a30fc9","page":"reading-block-e8d09daa81304bbebf6af1b6be1d73f0","operation":"move","beforeSHA256":"dcb8e8d813addd004512eb521afca8b20bd31d80bae379d10f6f8cbaf5ab78ea","afterSHA256":"dcb8e8d813addd004512eb521afca8b20bd31d80bae379d10f6f8cbaf5ab78ea","reason":"Same source body in authored semantic page"},{"oldId":"b-df02b822cc36277b51b7ba57","targetId":"b-df02b822cc36277b51b7ba57","page":"reading-block-fe69124edb824641b98df3d509006d26","operation":"move","beforeSHA256":"7ac059a5d6acbb7df7d7247594440f929f11e269e6fcf963e5ba04897da6d384","afterSHA256":"7ac059a5d6acbb7df7d7247594440f929f11e269e6fcf963e5ba04897da6d384","reason":"Same source body in authored semantic page"},{"oldId":"b-bd184b61e65ff0a23c1eed30","targetId":"b-bd184b61e65ff0a23c1eed30","page":"reading-block-fe69124edb824641b98df3d509006d26","operation":"move","beforeSHA256":"8c84bc02bf8463b8af196d9274f7ef282ba65908660b7d37377d26b2089fb89a","afterSHA256":"8c84bc02bf8463b8af196d9274f7ef282ba65908660b7d37377d26b2089fb89a","reason":"Same source body in authored semantic page"},{"oldId":"b-350df4695d8f9ab7af33f884","targetId":"b-350df4695d8f9ab7af33f884","page":"reading-block-fe69124edb824641b98df3d509006d26","operation":"move","beforeSHA256":"f735c764f3c62589e182b044ce6865be0ca8f039759bf7f5c7c9fd78ff665bc8","afterSHA256":"f735c764f3c62589e182b044ce6865be0ca8f039759bf7f5c7c9fd78ff665bc8","reason":"Same source body in authored semantic page"},{"oldId":"b-387c0554a5d938b77b18f3c4","targetId":"b-387c0554a5d938b77b18f3c4","page":"reading-block-fe69124edb824641b98df3d509006d26","operation":"move","beforeSHA256":"79dc7892efcc1da8af7ad16e65b10381d1673c6f5bc050b7caa39a0bbc70700d","afterSHA256":"79dc7892efcc1da8af7ad16e65b10381d1673c6f5bc050b7caa39a0bbc70700d","reason":"Same source body in authored semantic page"},{"oldId":"b-dafcf0048068c552262f8bd1","targetId":"b-dafcf0048068c552262f8bd1","page":"reading-block-fe69124edb824641b98df3d509006d26","operation":"rewrite","beforeSHA256":"59553c9ba48656516c2877a48c40f9bd5877d30685394467d521fd6bf0d407aa","afterSHA256":"3ec1e3ee3dbf7396948acd78933c373ecee23c156c809b4404de4b8571ad2360","reason":"Same source identity with figure semantics or reading context enriched"},{"oldId":"b-0b2bb034bc76a41ae63d5870","targetId":"b-0b2bb034bc76a41ae63d5870","page":"reading-block-fe69124edb824641b98df3d509006d26","operation":"move","beforeSHA256":"dbbef3216791ef1eafb392a02b9112093a80d3d42823b752d450b9df55faf7ea","afterSHA256":"1d0b2a7ce1bb72f95f0d4304d050899a306979d1b03fa92d2fc803a647ac7336","reason":"Same source body in authored semantic page"},{"oldId":"b-476f4c9f97923e1b4177d3e0","targetId":"b-476f4c9f97923e1b4177d3e0","page":"reading-block-fe69124edb824641b98df3d509006d26","operation":"move","beforeSHA256":"806fe8c86c3c9aadc4ffa157cb8edc8f2fc602542886779fdcb0e4d58fb0508e","afterSHA256":"806fe8c86c3c9aadc4ffa157cb8edc8f2fc602542886779fdcb0e4d58fb0508e","reason":"Same source body in authored semantic page"},{"oldId":"b-ec3ee30166356e98ee5a72c9","targetId":"b-ec3ee30166356e98ee5a72c9","page":"reading-block-fe69124edb824641b98df3d509006d26","operation":"move","beforeSHA256":"3497e96d58dc2972c4778f16299cd0d10bf3f4ec96e17723732b6a11da03e818","afterSHA256":"3497e96d58dc2972c4778f16299cd0d10bf3f4ec96e17723732b6a11da03e818","reason":"Same source body in authored semantic page"},{"oldId":"b-5f3418709fc786fd32f51fc8","targetId":"b-5f3418709fc786fd32f51fc8","page":"reading-block-fe69124edb824641b98df3d509006d26","operation":"rewrite","beforeSHA256":"878913f2158450839eda6f1adfc15d67f6a6b735a0971842f3e5823adc261502","afterSHA256":"ec5d460f4c48ecc687ff0935f8137756cf6a1467da9a7b1f45a6dc17dec31e0f","reason":"Same source identity with figure semantics or reading context enriched"},{"oldId":"b-299ae4e8a459c9a2eb4bc5ef","targetId":"b-299ae4e8a459c9a2eb4bc5ef","page":"reading-block-fe69124edb824641b98df3d509006d26","operation":"move","beforeSHA256":"b55b067d7e48b31ea372b22834be62e1e36721acdc3a5bfc7ffd04306b7901b8","afterSHA256":"b55b067d7e48b31ea372b22834be62e1e36721acdc3a5bfc7ffd04306b7901b8","reason":"Same source body in authored semantic page"},{"oldId":"b-8d295b97a3b861e92a0839f9","targetId":"b-8d295b97a3b861e92a0839f9","page":"reading-block-fe69124edb824641b98df3d509006d26","operation":"move","beforeSHA256":"1799601886b89f3c1ac7d43d891faf83d72a0cc4fe12e93c59c4a087d6dfc201","afterSHA256":"1799601886b89f3c1ac7d43d891faf83d72a0cc4fe12e93c59c4a087d6dfc201","reason":"Same source body in authored semantic page"},{"oldId":"b-8ac77609e3ec9a04e177b7be","targetId":"b-8ac77609e3ec9a04e177b7be","page":"reading-block-fe69124edb824641b98df3d509006d26","operation":"move","beforeSHA256":"2ec5369fc96bcf8962f7df785a96a1a27dcfbec593a55fc99ff5752411bcdcec","afterSHA256":"2ec5369fc96bcf8962f7df785a96a1a27dcfbec593a55fc99ff5752411bcdcec","reason":"Same source body in authored semantic page"},{"oldId":"b-650c2f55f0ed74cc4d226651","targetId":"b-650c2f55f0ed74cc4d226651","page":"reading-block-1cff4428a5f343258064d92cb3ab303d","operation":"move","beforeSHA256":"4c310beb24f67f7b41d22417d3d41805a995c0073d194cf3740c10a130a405a3","afterSHA256":"4c310beb24f67f7b41d22417d3d41805a995c0073d194cf3740c10a130a405a3","reason":"Same source body in authored semantic page"},{"oldId":"b-8021b889ddc4074a254b5f84","targetId":"b-8021b889ddc4074a254b5f84","page":"reading-block-1cff4428a5f343258064d92cb3ab303d","operation":"move","beforeSHA256":"73c81d282dc0a009ff3e11bf4f9acae506b11b852ad99bbbf05f1b824bea5d66","afterSHA256":"73c81d282dc0a009ff3e11bf4f9acae506b11b852ad99bbbf05f1b824bea5d66","reason":"Same source body in authored semantic page"},{"oldId":"b-d35cb4504f9610db053d0820","targetId":"b-d35cb4504f9610db053d0820","page":"reading-block-1cff4428a5f343258064d92cb3ab303d","operation":"move","beforeSHA256":"b04e147217a25fe3dc5695b3b5f963a1c7782d0c632515147ea7cf5f88231fb9","afterSHA256":"b04e147217a25fe3dc5695b3b5f963a1c7782d0c632515147ea7cf5f88231fb9","reason":"Same source body in authored semantic page"},{"oldId":"block-4f42285447374de387bf748b74f29f7f--5-2026-09-22-保存实测固定权重复核与关系分数","targetId":"b-a27e876fed1f0765d4e4d354","operation":"retain-source-identity"},{"oldId":"block-e8d09daa81304bbebf6af1b6be1d73f0--预处理和两条编码支路到底做了什么","targetId":"b-719e26a4931ee20702889e9e","operation":"retain-source-identity"},{"oldId":"block-fe69124edb824641b98df3d509006d26--同一对象只交换左右真实-clip-是否跟着关系改变","targetId":"b-df02b822cc36277b51b7ba57","operation":"retain-source-identity"},{"oldId":"block-1cff4428a5f343258064d92cb3ab303d--下一步同一批真实向量怎样变成检索系统","targetId":"b-650c2f55f0ed74cc4d226651","operation":"retain-source-identity"}],"blocks":[{"id":"b-a59caeec9cdca5de332ef82a","type":"h1","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-a59caeec9cdca5de332ef82a","content":"# LAB 04 · CLIP：候选、提示与关系检验","sha256":"ae7c40abec94303488a281999e287abd93b9f9a7acaf51d8616da6ff80f3b9a8","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-opening","title":"LAB 04 · CLIP：候选、提示与关系检验","number":1},"sectionTitle":"LAB 04 · CLIP：候选、提示与关系检验","currentQuestion":"LAB 04 · CLIP：候选、提示与关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-a1203c01e71c0432974dfbcd","prerequisites":[{"id":"b-a1203c01e71c0432974dfbcd","url":"#b-a1203c01e71c0432974dfbcd","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-a1203c01e71c0432974dfbcd","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-a1203c01e71c0432974dfbcd","content":"主线阅读与优先实验","sha256":"42cba31deccba2a350b9b23bd0ca1dcaa4c4c5cb9d35c773e1fcb89124788ccd","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-opening","title":"LAB 04 · CLIP：候选、提示与关系检验","number":1},"sectionTitle":"LAB 04 · CLIP：候选、提示与关系检验","currentQuestion":"LAB 04 · CLIP：候选、提示与关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-a59caeec9cdca5de332ef82a","nextBlock":"b-b5bf41e3a0647846d8a53661","prerequisites":[{"id":"b-a59caeec9cdca5de332ef82a","url":"#b-a59caeec9cdca5de332ef82a","role":"section-title"}],"relatedBlocks":[]},{"id":"b-b5bf41e3a0647846d8a53661","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-b5bf41e3a0647846d8a53661","content":"真实CLIP输入/权重/分数、候选改动、四条件规则与独立关系推理","sha256":"90e8ba62b9af4bedd5be3a2559568519f4df7a42b13048f81039496efd45dea2","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-opening","title":"LAB 04 · CLIP：候选、提示与关系检验","number":1},"sectionTitle":"LAB 04 · CLIP：候选、提示与关系检验","currentQuestion":"LAB 04 · CLIP：候选、提示与关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-a1203c01e71c0432974dfbcd","nextBlock":"b-d0363b2ec3173c04fa1662cd","prerequisites":[{"id":"b-a59caeec9cdca5de332ef82a","url":"#b-a59caeec9cdca5de332ef82a","role":"section-title"},{"id":"b-a1203c01e71c0432974dfbcd","url":"#b-a1203c01e71c0432974dfbcd","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-d0363b2ec3173c04fa1662cd","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-d0363b2ec3173c04fa1662cd","content":"可先阅读已有结果，再决定是否运行。重算时请核对各节记录的数据、参数、环境与日期。","sha256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-opening","title":"LAB 04 · CLIP：候选、提示与关系检验","number":1},"sectionTitle":"LAB 04 · CLIP：候选、提示与关系检验","currentQuestion":"LAB 04 · CLIP：候选、提示与关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-b5bf41e3a0647846d8a53661","nextBlock":"b-e91f15940932f6063f3e37ab","prerequisites":[{"id":"b-a59caeec9cdca5de332ef82a","url":"#b-a59caeec9cdca5de332ef82a","role":"section-title"},{"id":"b-a1203c01e71c0432974dfbcd","url":"#b-a1203c01e71c0432974dfbcd","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-e91f15940932f6063f3e37ab","type":"p","scope":"block-6ee1d767afb744e18fbfa9989ac3cd72","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-e91f15940932f6063f3e37ab","content":"**学习路径：** [文字候选与图文检索](/course/study/clip-retrieval.html)","sha256":"bab4bd804571aa5afbaf197e9c1539510fc766578c9825aa46cadbb18444cc32","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-opening","title":"LAB 04 · CLIP：候选、提示与关系检验","number":1},"sectionTitle":"LAB 04 · CLIP：候选、提示与关系检验","currentQuestion":"LAB 04 · CLIP：候选、提示与关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-d0363b2ec3173c04fa1662cd","nextBlock":"b-086faa9d2594c28492e778ac","prerequisites":[{"id":"b-a59caeec9cdca5de332ef82a","url":"#b-a59caeec9cdca5de332ef82a","role":"section-title"},{"id":"b-a1203c01e71c0432974dfbcd","url":"#b-a1203c01e71c0432974dfbcd","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-086faa9d2594c28492e778ac","type":"p","scope":"block-6ee1d767afb744e18fbfa9989ac3cd72","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-086faa9d2594c28492e778ac","content":"**固定图像与模型，只改文字候选，哪些量应保持，哪些量会变？** 先读[P58](/course/pages/l3-r2-p58.html)和[候选概率算例](/course/blocks/clip-candidate-probability.html)，再比较本册第1节猫图的四个条件：加候选、换模板、删去cat。","sha256":"17eb4c37b11d5afe331c6db83817582dd19a2360d19a42934f22620d3efc34f8","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-opening","title":"LAB 04 · CLIP：候选、提示与关系检验","number":1},"sectionTitle":"LAB 04 · CLIP：候选、提示与关系检验","currentQuestion":"LAB 04 · CLIP：候选、提示与关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-e91f15940932f6063f3e37ab","nextBlock":"b-96b7e678460cf1fb4b7b60d7","prerequisites":[{"id":"b-a59caeec9cdca5de332ef82a","url":"#b-a59caeec9cdca5de332ef82a","role":"section-title"},{"id":"b-a1203c01e71c0432974dfbcd","url":"#b-a1203c01e71c0432974dfbcd","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-96b7e678460cf1fb4b7b60d7","type":"p","scope":"block-6ee1d767afb744e18fbfa9989ac3cd72","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-96b7e678460cf1fb4b7b60d7","content":"这里的zero-shot是不使用当前下游数据集再训练模型，直接用已有图像和文字编码器比较候选；并不保证相关概念从未进入预训练资料。读结果时同时记录cosine、候选softmax与top-1，解释为什么新增候选可改变softmax却不改变原有cosine。","sha256":"7cb69821f69a051b3852548284305c334f86d24891322c1f75467877151f8d0c","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-opening","title":"LAB 04 · CLIP：候选、提示与关系检验","number":1},"sectionTitle":"LAB 04 · CLIP：候选、提示与关系检验","currentQuestion":"LAB 04 · CLIP：候选、提示与关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-086faa9d2594c28492e778ac","nextBlock":"b-c0a05fb017484d91c11a8281","prerequisites":[{"id":"b-a59caeec9cdca5de332ef82a","url":"#b-a59caeec9cdca5de332ef82a","role":"section-title"},{"id":"b-a1203c01e71c0432974dfbcd","url":"#b-a1203c01e71c0432974dfbcd","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-c0a05fb017484d91c11a8281","type":"p","scope":"block-6ee1d767afb744e18fbfa9989ac3cd72","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-c0a05fb017484d91c11a8281","content":"最短路线：四臂设计 → 已保存真实结果 → 第5节关系反例。开头持球规则是可跳过的解析热身。想重算时按原代码顺序准备；默认`RUN_CLIP=False`、`RUN_FRESH_CLIP=False`，只准备或读缓存，不能称为本次模型推理。模型、照片和2026-09-22复核的来源在各结果旁保留。","sha256":"2739e67308cfdf38b94e3f702cb12b8ad07b1a4c9b828e79fa591fcc5181faff","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-opening","title":"LAB 04 · CLIP：候选、提示与关系检验","number":1},"sectionTitle":"LAB 04 · CLIP：候选、提示与关系检验","currentQuestion":"LAB 04 · CLIP：候选、提示与关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-96b7e678460cf1fb4b7b60d7","nextBlock":"b-0023f17af8ab3853b5a8b9f4","prerequisites":[{"id":"b-a59caeec9cdca5de332ef82a","url":"#b-a59caeec9cdca5de332ef82a","role":"section-title"},{"id":"b-a1203c01e71c0432974dfbcd","url":"#b-a1203c01e71c0432974dfbcd","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-0023f17af8ab3853b5a8b9f4","type":"p","scope":"block-6ee1d767afb744e18fbfa9989ac3cd72","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-0023f17af8ab3853b5a8b9f4","content":"完成后留下一个具体对照：固定了什么、改变了什么、哪个分数因此改变。需要把向量做成图库时再进入[LAB 12](https://deepnote.com/project/38755e4e-23f6-4f5f-8c68-8a2e4114b1c1/notebook/921eeaf784284ce19568c6ca7619b55a)，不重复做一份猫图实验。","sha256":"e413a378e31c7f5c9e110f8a97a90c647c8b36cdca962006ec630adc29a414ff","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-opening","title":"LAB 04 · CLIP：候选、提示与关系检验","number":1},"sectionTitle":"LAB 04 · CLIP：候选、提示与关系检验","currentQuestion":"LAB 04 · CLIP：候选、提示与关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-c0a05fb017484d91c11a8281","nextBlock":null,"prerequisites":[{"id":"b-a59caeec9cdca5de332ef82a","url":"#b-a59caeec9cdca5de332ef82a","role":"section-title"},{"id":"b-a1203c01e71c0432974dfbcd","url":"#b-a1203c01e71c0432974dfbcd","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-a3c655b55da3a051a9a89cb2","type":"h3","scope":"block-49f411cef216497594cb4ab917f97b2f","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-a3c655b55da3a051a9a89cb2","content":"### 先做一个无需模型的关系检验","sha256":"ac9101f564470c682fd7f7fc46f6980ebd397445e3a0baa029d1ff240079176d","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-49f411cef216497594cb4ab917f97b2f","title":"先做一个无需模型的关系检验","number":2},"sectionTitle":"先做一个无需模型的关系检验","currentQuestion":"先做一个无需模型的关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-eb82be40a9fef6046057996c","prerequisites":[{"id":"b-eb82be40a9fef6046057996c","url":"#b-eb82be40a9fef6046057996c","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-eb82be40a9fef6046057996c","type":"p","scope":"block-d19f00cd82bd4f5391c89134e56b7239","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-eb82be40a9fef6046057996c","content":"**观察同一套 A/B 候选，再预测两条规则。** 左右均按观看者位置。","sha256":"a3d6b0b3480b9dd8f638525099e38b5aa94a4ecd0715d954046e4379bd07cca9","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-49f411cef216497594cb4ab917f97b2f","title":"先做一个无需模型的关系检验","number":2},"sectionTitle":"先做一个无需模型的关系检验","currentQuestion":"先做一个无需模型的关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-a3c655b55da3a051a9a89cb2","nextBlock":"b-025421f0f8119aef9de3208e","prerequisites":[{"id":"b-a3c655b55da3a051a9a89cb2","url":"#b-a3c655b55da3a051a9a89cb2","role":"section-title"}],"relatedBlocks":[]},{"id":"b-025421f0f8119aef9de3208e","type":"p","scope":"block-d19f00cd82bd4f5391c89134e56b7239","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-025421f0f8119aef9de3208e","content":"A. `A person in red holds a ball beside a person in blue.`","sha256":"002ee180ca7d8b372df681eb1b2b825f74f69a045e7f69aefa8b7dbdb04e0676","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-49f411cef216497594cb4ab917f97b2f","title":"先做一个无需模型的关系检验","number":2},"sectionTitle":"先做一个无需模型的关系检验","currentQuestion":"先做一个无需模型的关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-eb82be40a9fef6046057996c","nextBlock":"b-2a978113bd3539e024bf35f9","prerequisites":[{"id":"b-a3c655b55da3a051a9a89cb2","url":"#b-a3c655b55da3a051a9a89cb2","role":"section-title"},{"id":"b-eb82be40a9fef6046057996c","url":"#b-eb82be40a9fef6046057996c","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-2a978113bd3539e024bf35f9","type":"p","scope":"block-d19f00cd82bd4f5391c89134e56b7239","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-2a978113bd3539e024bf35f9","content":"B. `A person in blue holds a ball beside a person in red.`","sha256":"eff7bd92a5815c6392c5337752565d07dbb033bd592078e262f85208f537b28f","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-49f411cef216497594cb4ab917f97b2f","title":"先做一个无需模型的关系检验","number":2},"sectionTitle":"先做一个无需模型的关系检验","currentQuestion":"先做一个无需模型的关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-025421f0f8119aef9de3208e","nextBlock":"b-b6eef90132caf12132b49c03","prerequisites":[{"id":"b-a3c655b55da3a051a9a89cb2","url":"#b-a3c655b55da3a051a9a89cb2","role":"section-title"},{"id":"b-eb82be40a9fef6046057996c","url":"#b-eb82be40a9fef6046057996c","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-b6eef90132caf12132b49c03","type":"table","scope":"block-d19f00cd82bd4f5391c89134e56b7239","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-b6eef90132caf12132b49c03","content":"| 条件 1：左红持球、右蓝 | 条件 2：左蓝持球、右红 |\n| --- | --- |\n| ![条件1：观看者左侧红衣人持球，右侧蓝衣人不接触球](/course/knowledge-assets/b44ae6205135966005a376cd.jpg) | ![条件2：观看者左侧蓝衣人持球，右侧红衣人不接触球](/course/knowledge-assets/a2fad6392231baa79e7361b8.jpg) |","sha256":"9bacd479447d1472924103d646683567689bca6262b8ef5039014313bcb7e44b","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-49f411cef216497594cb4ab917f97b2f","title":"先做一个无需模型的关系检验","number":2},"sectionTitle":"先做一个无需模型的关系检验","currentQuestion":"先做一个无需模型的关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"table":{"headers":["条件 1：左红持球、右蓝","条件 2：左蓝持球、右红"],"rows":[["条件 1：左红持球、右蓝","条件 2：左蓝持球、右红"],["",""]]},"previousBlock":"b-2a978113bd3539e024bf35f9","nextBlock":"b-0e353d81c506f83d28a7508f","prerequisites":[{"id":"b-a3c655b55da3a051a9a89cb2","url":"#b-a3c655b55da3a051a9a89cb2","role":"section-title"},{"id":"b-eb82be40a9fef6046057996c","url":"#b-eb82be40a9fef6046057996c","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-0e353d81c506f83d28a7508f","type":"table","scope":"block-d19f00cd82bd4f5391c89134e56b7239","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-0e353d81c506f83d28a7508f","content":"| 条件 3：左红、右蓝持球 | 条件 4：左蓝、右红持球 |\n| --- | --- |\n| ![条件3：观看者左侧红衣人，右侧蓝衣人持球](/course/knowledge-assets/429e669b3080a200d8e3b65c.jpg) | ![条件4：观看者左侧蓝衣人，右侧红衣人持球](/course/knowledge-assets/62eb7ad7573b1dc20562ec8a.jpg) |","sha256":"1e78fc525a8f547a5c4ad3030ff12f86307c3912c6f56f2a1f8883efc024cc4a","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-49f411cef216497594cb4ab917f97b2f","title":"先做一个无需模型的关系检验","number":2},"sectionTitle":"先做一个无需模型的关系检验","currentQuestion":"先做一个无需模型的关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"table":{"headers":["条件 3：左红、右蓝持球","条件 4：左蓝、右红持球"],"rows":[["条件 3：左红、右蓝持球","条件 4：左蓝、右红持球"],["",""]]},"previousBlock":"b-b6eef90132caf12132b49c03","nextBlock":"b-b92f4ebf3088e5c3f44e65e1","prerequisites":[{"id":"b-a3c655b55da3a051a9a89cb2","url":"#b-a3c655b55da3a051a9a89cb2","role":"section-title"},{"id":"b-eb82be40a9fef6046057996c","url":"#b-eb82be40a9fef6046057996c","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-b92f4ebf3088e5c3f44e65e1","type":"p","scope":"block-d19f00cd82bd4f5391c89134e56b7239","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-b92f4ebf3088e5c3f44e65e1","content":"ImageGen 情境插图。对象、衣色、左右与持球身份按条件核对；独立生成图中的姿态、背景与光照也可能变化，因此不是严格单变量照片实验。","sha256":"8dd803defe959aafbe275233401562ad3c7e5d046d7244df78326c946ddec48a","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-49f411cef216497594cb4ab917f97b2f","title":"先做一个无需模型的关系检验","number":2},"sectionTitle":"先做一个无需模型的关系检验","currentQuestion":"先做一个无需模型的关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-0e353d81c506f83d28a7508f","nextBlock":"b-0440ed645a50f20292a71fe4","prerequisites":[{"id":"b-a3c655b55da3a051a9a89cb2","url":"#b-a3c655b55da3a051a9a89cb2","role":"section-title"},{"id":"b-eb82be40a9fef6046057996c","url":"#b-eb82be40a9fef6046057996c","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-0440ed645a50f20292a71fe4","type":"p","scope":"block-d19f00cd82bd4f5391c89134e56b7239","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-0440ed645a50f20292a71fe4","content":"在前两种条件里，“看持球者衣色”和“只看左侧衣色”给出相同答案。先不运行代码，分别填入条件 3/4 下两条规则会选 A 还是 B。哪一个改动使两条解释产生不同预测？","sha256":"3628eb0bcd27fe1e82d4e90dac3a0c44ae048ebf06483616967c8a9fa285f320","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-49f411cef216497594cb4ab917f97b2f","title":"先做一个无需模型的关系检验","number":2},"sectionTitle":"先做一个无需模型的关系检验","currentQuestion":"先做一个无需模型的关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-b92f4ebf3088e5c3f44e65e1","nextBlock":"b-e1f28cc4a760b2b10995f250","prerequisites":[{"id":"b-a3c655b55da3a051a9a89cb2","url":"#b-a3c655b55da3a051a9a89cb2","role":"section-title"},{"id":"b-eb82be40a9fef6046057996c","url":"#b-eb82be40a9fef6046057996c","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-e1f28cc4a760b2b10995f250","type":"p","scope":"block-d19f00cd82bd4f5391c89134e56b7239","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-e1f28cc4a760b2b10995f250","content":"共享素材：本讲新版持球四条件，按观看者左右排列；每图两人一个球，非持球人不接触球。图像来自同一人物场景的编辑与条件重组，用于区分两条规则，不是模型推理结果。","sha256":"abdc1a7d771aeebf9025a397b0951fd408f0d98959a528ef50dfe9d6db7ec644","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-49f411cef216497594cb4ab917f97b2f","title":"先做一个无需模型的关系检验","number":2},"sectionTitle":"先做一个无需模型的关系检验","currentQuestion":"先做一个无需模型的关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-0440ed645a50f20292a71fe4","nextBlock":"b-a88f96e4b5c2df2747f153a1","prerequisites":[{"id":"b-a3c655b55da3a051a9a89cb2","url":"#b-a3c655b55da3a051a9a89cb2","role":"section-title"},{"id":"b-eb82be40a9fef6046057996c","url":"#b-eb82be40a9fef6046057996c","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-a88f96e4b5c2df2747f153a1","type":"pre","scope":"block-b5078a7304e54d9fa89ee186821582fb","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-a88f96e4b5c2df2747f153a1","content":"```\n# 每次整册运行使用临时工作目录，保留项目旧文件与历史结果。\nimport os, tempfile\nL03_RUN_DIR=tempfile.mkdtemp(prefix=\"lecture03-lab04-\")\nos.chdir(L03_RUN_DIR)\n# 可独立运行；无需前面任何模型、文件或隐藏变量。\n# 改 holder 为 left/right，先预测，再看两条规则是否仍然一致。\nconditions = [\n    {'condition': 1, 'left': 'red', 'right': 'blue', 'holder': 'left'},\n    {'condition': 2, 'left': 'blue', 'right': 'red', 'holder': 'left'},\n    {'condition': 3, 'left': 'red', 'right': 'blue', 'holder': 'right'},\n    {'condition': 4, 'left': 'blue', 'right': 'red', 'holder': 'right'},\n]\ndef choice_for_color(color):\n    return {'red': 'A', 'blue': 'B'}[color]\ndef compare_rules(case):\n    relation = choice_for_color(case[case['holder']])\n    position = choice_for_color(case['left'])\n    return relation, position\nassert compare_rules({'left':'red','right':'blue','holder':'right'}) == ('B','A')\nprint('条件 | 持球关系规则 | 左侧颜色规则 | 两者不同')\nfor case in conditions:\n    relation, position = compare_rules(case)\n    print(case['condition'], relation, position, relation != position)\n\n```","sha256":"9a9baebeb838798aee785b3281a47bc49464072d063ab2e9a336bb823028f544","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-49f411cef216497594cb4ab917f97b2f","title":"先做一个无需模型的关系检验","number":2},"sectionTitle":"先做一个无需模型的关系检验","currentQuestion":"先做一个无需模型的关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-e1f28cc4a760b2b10995f250","nextBlock":"b-bd65196c031894682b2ab8b1","prerequisites":[{"id":"b-a3c655b55da3a051a9a89cb2","url":"#b-a3c655b55da3a051a9a89cb2","role":"section-title"},{"id":"b-eb82be40a9fef6046057996c","url":"#b-eb82be40a9fef6046057996c","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-bd65196c031894682b2ab8b1","type":"p","scope":"block-852fd1d91125421093ffcda34307c805","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-bd65196c031894682b2ab8b1","content":"**确定性规则结果**（也可直接阅读）：","sha256":"6af71429e89201825c75c19463619eead112b42aab01c27cfb2a622bbed03021","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-49f411cef216497594cb4ab917f97b2f","title":"先做一个无需模型的关系检验","number":2},"sectionTitle":"先做一个无需模型的关系检验","currentQuestion":"先做一个无需模型的关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-a88f96e4b5c2df2747f153a1","nextBlock":"b-e654f90a5e895aad3db158b7","prerequisites":[{"id":"b-a3c655b55da3a051a9a89cb2","url":"#b-a3c655b55da3a051a9a89cb2","role":"section-title"},{"id":"b-eb82be40a9fef6046057996c","url":"#b-eb82be40a9fef6046057996c","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-e654f90a5e895aad3db158b7","type":"table","scope":"block-852fd1d91125421093ffcda34307c805","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-e654f90a5e895aad3db158b7","content":"| 条件 | 按持球关系 | 按左侧衣色 | 能否区分两条规则 |\n| --- | --- | --- | --- |\n| 1 | A | A | 不能 |\n| 2 | B | B | 不能 |\n| 3 | B | A | 能 |\n| 4 | A | B | 能 |","sha256":"52d0d0032a15d84c465719b1bba9c90592f9709384a91537cba344375c310ce0","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-49f411cef216497594cb4ab917f97b2f","title":"先做一个无需模型的关系检验","number":2},"sectionTitle":"先做一个无需模型的关系检验","currentQuestion":"先做一个无需模型的关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"table":{"headers":["条件","按持球关系","按左侧衣色","能否区分两条规则"],"rows":[["条件","按持球关系","按左侧衣色","能否区分两条规则"],["1","A","A","不能"],["2","B","B","不能"],["3","B","A","能"],["4","A","B","能"]]},"previousBlock":"b-bd65196c031894682b2ab8b1","nextBlock":"b-86406523dc6c9dc8f5bf979d","prerequisites":[{"id":"b-a3c655b55da3a051a9a89cb2","url":"#b-a3c655b55da3a051a9a89cb2","role":"section-title"},{"id":"b-eb82be40a9fef6046057996c","url":"#b-eb82be40a9fef6046057996c","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-86406523dc6c9dc8f5bf979d","type":"p","scope":"block-852fd1d91125421093ffcda34307c805","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-86406523dc6c9dc8f5bf979d","content":"这些值来自条件定义和规则计算，不是 CLIP 相似度。若要检验真实模型，需要固定 A/B 文句，对全部四张图实际推理，再比较结果是否追踪持球关系。即使通过这四例，也仍需更多对象、布局与表达方式。","sha256":"2f622a9fa22527aa604d1e937d6beb9c67c02ae7e6ff106b26fca7a92616efcb","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-49f411cef216497594cb4ab917f97b2f","title":"先做一个无需模型的关系检验","number":2},"sectionTitle":"先做一个无需模型的关系检验","currentQuestion":"先做一个无需模型的关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-e654f90a5e895aad3db158b7","nextBlock":"b-a91d8a63a5c265d25c64fd2f","prerequisites":[{"id":"b-a3c655b55da3a051a9a89cb2","url":"#b-a3c655b55da3a051a9a89cb2","role":"section-title"},{"id":"b-eb82be40a9fef6046057996c","url":"#b-eb82be40a9fef6046057996c","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-a91d8a63a5c265d25c64fd2f","type":"p","scope":"block-852fd1d91125421093ffcda34307c805","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-a91d8a63a5c265d25c64fd2f","content":"接下来保留的猫图实验回答另一个问题：候选与提示变化怎样改变真实 CLIP 的相对分数。图文匹配提供整图候选分数；需要区域坐标时看 CLS 03 的 GLIP，需要自由回答时看 LLaVA 的接口与训练。","sha256":"c74240826351f9ed7a36ac6cd17bdc1384a79161fff35eb05cd6cfb8abdb1ab1","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-49f411cef216497594cb4ab917f97b2f","title":"先做一个无需模型的关系检验","number":2},"sectionTitle":"先做一个无需模型的关系检验","currentQuestion":"先做一个无需模型的关系检验","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-86406523dc6c9dc8f5bf979d","nextBlock":null,"prerequisites":[{"id":"b-a3c655b55da3a051a9a89cb2","url":"#b-a3c655b55da3a051a9a89cb2","role":"section-title"},{"id":"b-eb82be40a9fef6046057996c","url":"#b-eb82be40a9fef6046057996c","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-3126dfb7647cb23c4a6fa9a8","type":"h3","scope":"block-2a5577cae28d48a29bceae894948ab01","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-3126dfb7647cb23c4a6fa9a8","content":"### 1 · 图像不变，换文字候选改变了什么？","sha256":"dba7baea294bf7c0a8fc38bb9dbe4e885f17f0d5d3f416485c1a2a744a11a944","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-2a5577cae28d48a29bceae894948ab01","title":"1 · 图像不变，换文字候选改变了什么？","number":3},"sectionTitle":"1 · 图像不变，换文字候选改变了什么？","currentQuestion":"1 · 图像不变，换文字候选改变了什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-7e0475d2aea39df2f333c5bc","prerequisites":[{"id":"b-7e0475d2aea39df2f333c5bc","url":"#b-7e0475d2aea39df2f333c5bc","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-7e0475d2aea39df2f333c5bc","type":"p","scope":"block-fc8ddc9df75d4837b5394962ee0837d3","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-7e0475d2aea39df2f333c5bc","content":"历史保存结果使用 **OpenAI CLIP ViT-B/32** 的真实预训练权重与固定真实照片 Chelsea the cat（Stefan van der Walt，CC0，来自 scikit-image v0.25.2）。模型与官方预处理固定，不做任何梯度更新。模型的大规模图文预训练没有在本册重做。","sha256":"696a7a68b46eba274aa0f56872a9de8a7ba799867870737a10d37d76c46ccb0f","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-2a5577cae28d48a29bceae894948ab01","title":"1 · 图像不变，换文字候选改变了什么？","number":3},"sectionTitle":"1 · 图像不变，换文字候选改变了什么？","currentQuestion":"1 · 图像不变，换文字候选改变了什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-3126dfb7647cb23c4a6fa9a8","nextBlock":"b-60ffe34842c91700f2590407","prerequisites":[{"id":"b-3126dfb7647cb23c4a6fa9a8","url":"#b-3126dfb7647cb23c4a6fa9a8","role":"section-title"}],"relatedBlocks":[]},{"id":"b-60ffe34842c91700f2590407","type":"p","scope":"block-fc8ddc9df75d4837b5394962ee0837d3","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-60ffe34842c91700f2590407","content":"比较分为四臂，避免把候选集合与 prompt 同时改变：","sha256":"afdaa6ba5eb44248015c0abeff985f0fc8bc483483ce7ddeea53ad3887481e04","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-2a5577cae28d48a29bceae894948ab01","title":"1 · 图像不变，换文字候选改变了什么？","number":3},"sectionTitle":"1 · 图像不变，换文字候选改变了什么？","currentQuestion":"1 · 图像不变，换文字候选改变了什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-7e0475d2aea39df2f333c5bc","nextBlock":"b-45025d34087a8968a6bf2419","prerequisites":[{"id":"b-3126dfb7647cb23c4a6fa9a8","url":"#b-3126dfb7647cb23c4a6fa9a8","role":"section-title"},{"id":"b-7e0475d2aea39df2f333c5bc","url":"#b-7e0475d2aea39df2f333c5bc","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-45025d34087a8968a6bf2419","type":"table","scope":"block-fc8ddc9df75d4837b5394962ee0837d3","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-45025d34087a8968a6bf2419","content":"| 臂 | 候选 | prompt | 隔离的问题 |\n| --- | --- | --- | --- |\n| A | cat / dog / horse | a photo of a `{name}`. | 固定的基线任务 |\n| B | cat / dog / horse / tiger / fox | 与 A 相同 | 只扩展候选集合 |\n| C | 与 A 相同 | a cropped photo of a `{name}`. | 只改变描述模板 |\n| D | dog / horse / tiger / fox | 与 A 相同 | 删除原正确类别，改变可选答案空间 |","sha256":"bf0e8263b3b3471fd1bb36c67d008e4fcda92a38a04a927196d2f8c4312012a1","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-2a5577cae28d48a29bceae894948ab01","title":"1 · 图像不变，换文字候选改变了什么？","number":3},"sectionTitle":"1 · 图像不变，换文字候选改变了什么？","currentQuestion":"1 · 图像不变，换文字候选改变了什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"table":{"headers":["臂","候选","prompt","隔离的问题"],"rows":[["臂","候选","prompt","隔离的问题"],["A","cat / dog / horse","a photo of a {name}.","固定的基线任务"],["B","cat / dog / horse / tiger / fox","与 A 相同","只扩展候选集合"],["C","与 A 相同","a cropped photo of a {name}.","只改变描述模板"],["D","dog / horse / tiger / fox","与 A 相同","删除原正确类别，改变可选答案空间"]]},"previousBlock":"b-60ffe34842c91700f2590407","nextBlock":"b-7e360719307351da14bb607c","prerequisites":[{"id":"b-3126dfb7647cb23c4a6fa9a8","url":"#b-3126dfb7647cb23c4a6fa9a8","role":"section-title"},{"id":"b-7e0475d2aea39df2f333c5bc","url":"#b-7e0475d2aea39df2f333c5bc","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-7e360719307351da14bb607c","type":"p","scope":"block-fc8ddc9df75d4837b5394962ee0837d3","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-7e360719307351da14bb607c","content":"记录 **cosine 相似度、模型 logit scale、softmax、top-1**。当只扩展候选集时，共享候选的 cosine 应保持不变，而 softmax 会因分母改变。D 以 B 为直接对照：候选集只删除 cat、保留 B 的其余候选和 prompt。删除 cat 后，模型仍必须从剩余候选选一个；高相对分数不构成“开放世界里确定有它”的证明。","sha256":"2e8df714b4e26523424479430c4106c4ae2cc9a32f1a91c79201e1ceb0b03a25","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-2a5577cae28d48a29bceae894948ab01","title":"1 · 图像不变，换文字候选改变了什么？","number":3},"sectionTitle":"1 · 图像不变，换文字候选改变了什么？","currentQuestion":"1 · 图像不变，换文字候选改变了什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-45025d34087a8968a6bf2419","nextBlock":"b-948e95e440d2bc0333245546","prerequisites":[{"id":"b-3126dfb7647cb23c4a6fa9a8","url":"#b-3126dfb7647cb23c4a6fa9a8","role":"section-title"},{"id":"b-7e0475d2aea39df2f333c5bc","url":"#b-7e0475d2aea39df2f333c5bc","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-948e95e440d2bc0333245546","type":"p","scope":"block-fc8ddc9df75d4837b5394962ee0837d3","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-948e95e440d2bc0333245546","content":"重算需安装 `requirements.txt`，运行 `python fetch_clip.py` 取得固定 revision 权重，再运行本节。下载失败时本节明确标为未运行；没有用随机相似度代替。模型文件约 600 MB，不放入教学小包。","sha256":"185518c84d3d21a139f9f2a07beeb350c944048a8275369319217304556c74fc","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-2a5577cae28d48a29bceae894948ab01","title":"1 · 图像不变，换文字候选改变了什么？","number":3},"sectionTitle":"1 · 图像不变，换文字候选改变了什么？","currentQuestion":"1 · 图像不变，换文字候选改变了什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-7e360719307351da14bb607c","nextBlock":"b-6bafbc73a59a2eeca2087b9d","prerequisites":[{"id":"b-3126dfb7647cb23c4a6fa9a8","url":"#b-3126dfb7647cb23c4a6fa9a8","role":"section-title"},{"id":"b-7e0475d2aea39df2f333c5bc","url":"#b-7e0475d2aea39df2f333c5bc","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-6bafbc73a59a2eeca2087b9d","type":"p","scope":"block-fc8ddc9df75d4837b5394962ee0837d3","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-6bafbc73a59a2eeca2087b9d","content":"来源：[OpenAI CLIP 官方实现](https://github.com/openai/CLIP)；[官方模型卡](https://huggingface.co/openai/clip-vit-base-patch32)；[真实照片](https://scikit-image.org/docs/stable/api/skimage.data.html#skimage.data.chelsea)。","sha256":"e1bbf303cd2f3a9fb0d5bb00b4e0bdd572b9d381dda48a5c44776a801b038d2f","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-2a5577cae28d48a29bceae894948ab01","title":"1 · 图像不变，换文字候选改变了什么？","number":3},"sectionTitle":"1 · 图像不变，换文字候选改变了什么？","currentQuestion":"1 · 图像不变，换文字候选改变了什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-948e95e440d2bc0333245546","nextBlock":"b-04eb1c391bdbf46622c8b10a","prerequisites":[{"id":"b-3126dfb7647cb23c4a6fa9a8","url":"#b-3126dfb7647cb23c4a6fa9a8","role":"section-title"},{"id":"b-7e0475d2aea39df2f333c5bc","url":"#b-7e0475d2aea39df2f333c5bc","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-04eb1c391bdbf46622c8b10a","type":"p","scope":"block-fc8ddc9df75d4837b5394962ee0837d3","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-04eb1c391bdbf46622c8b10a","content":"**预处理复核（2026-09-18）：**本包固定 `transformers==4.57.1` 与模型 revision。保存输出中的 `use_fast` 提醒说明当时使用 `CLIPImageProcessor`，不是执行失败。2026-09-18 的复核将同一慢图像处理器和 `CLIPTokenizerFast` 分开显式指定：RGB → 短边缩放 224（bicubic）→ 224×224 中心裁剪 → 按官方均值／标准差归一化。用包内同一照片及四臂全部 prompt，仅重跑预处理，所得像素张量和 token IDs 与原默认选择完全相同（最大像素张量差 0）。原相似度、图和输出仍是此前模型推理保存结果；该次预处理复核没有重跑模型。详细复核见包内 `results/preprocessing-audit-20260918.json`。","sha256":"19d12afe8e40a8cf7b89ad4289b1455d25d83acb8179520486bf113ae38dcb13","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-2a5577cae28d48a29bceae894948ab01","title":"1 · 图像不变，换文字候选改变了什么？","number":3},"sectionTitle":"1 · 图像不变，换文字候选改变了什么？","currentQuestion":"1 · 图像不变，换文字候选改变了什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-6bafbc73a59a2eeca2087b9d","nextBlock":null,"prerequisites":[{"id":"b-3126dfb7647cb23c4a6fa9a8","url":"#b-3126dfb7647cb23c4a6fa9a8","role":"section-title"},{"id":"b-7e0475d2aea39df2f333c5bc","url":"#b-7e0475d2aea39df2f333c5bc","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-f83c06e30511cf60ea488ef2","type":"h3","scope":"block-2277d769b3f944bfb8a35fe185c93e32","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-f83c06e30511cf60ea488ef2","content":"### 已保存的真实结果：v16 教师 CPU 推理","sha256":"b45eb5d03b596bf0c2b4cb6e66e1a268efcf18ae5fcbbd73265263da940613c0","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-2277d769b3f944bfb8a35fe185c93e32","title":"已保存的真实结果：v16 教师 CPU 推理","number":4},"sectionTitle":"已保存的真实结果：v16 教师 CPU 推理","currentQuestion":"已保存的真实结果：v16 教师 CPU 推理","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-4dfc7ff6e17d4bb63aac9239","prerequisites":[{"id":"b-4dfc7ff6e17d4bb63aac9239","url":"#b-4dfc7ff6e17d4bb63aac9239","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-4dfc7ff6e17d4bb63aac9239","type":"p","scope":"block-e8ab1372e4794474b1dd5aa548d4fe86","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-4dfc7ff6e17d4bb63aac9239","content":"下图和表是保留的 v16 教师 CPU 推理，当前整理没有重新运行模型，不依赖下一格的 `RUN_CLIP` 值。原权重与照片哈希写在配套 provenance 中。","sha256":"c85985cd5331e0560a38087c007fc3216d1a1846e79d4da462f86ebc99cfbd92","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-2277d769b3f944bfb8a35fe185c93e32","title":"已保存的真实结果：v16 教师 CPU 推理","number":4},"sectionTitle":"已保存的真实结果：v16 教师 CPU 推理","currentQuestion":"已保存的真实结果：v16 教师 CPU 推理","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-f83c06e30511cf60ea488ef2","nextBlock":"b-5f002549bdef4f3350690cbb","prerequisites":[{"id":"b-f83c06e30511cf60ea488ef2","url":"#b-f83c06e30511cf60ea488ef2","role":"section-title"}],"relatedBlocks":[]},{"id":"b-5f002549bdef4f3350690cbb","type":"p","scope":"block-e8ab1372e4794474b1dd5aa548d4fe86","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-5f002549bdef4f3350690cbb","content":"![固定照片与候选比较](/assets/display/fed4bc77235bae1509d5761b.webp)","sha256":"a71426d4749e4a541ba3dcf2296584e8cae0de1144f80b417b32abf8dc516bdc","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-2277d769b3f944bfb8a35fe185c93e32","title":"已保存的真实结果：v16 教师 CPU 推理","number":4},"sectionTitle":"已保存的真实结果：v16 教师 CPU 推理","currentQuestion":"已保存的真实结果：v16 教师 CPU 推理","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-4dfc7ff6e17d4bb63aac9239","nextBlock":"b-1c9eb656f885ff60c93e792d","prerequisites":[{"id":"b-f83c06e30511cf60ea488ef2","url":"#b-f83c06e30511cf60ea488ef2","role":"section-title"},{"id":"b-4dfc7ff6e17d4bb63aac9239","url":"#b-4dfc7ff6e17d4bb63aac9239","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-1c9eb656f885ff60c93e792d","type":"table","scope":"block-e8ab1372e4794474b1dd5aa548d4fe86","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-1c9eb656f885ff60c93e792d","content":"| 臂 | top-1 | 候选：cosine / softmax |\n| --- | --- | --- |\n| A_base | cat | cat: 0.2869/0.9958；dog: 0.2310/0.0037；horse: 0.2109/0.0005 |\n| Bexpandonly | cat | cat: 0.2869/0.9819；dog: 0.2310/0.0037；horse: 0.2109/0.0005；tiger: 0.2436/0.0130；fox: 0.2173/0.0009 |\n| Cpromptonly | cat | cat: 0.2933/0.9951；dog: 0.2368/0.0035；horse: 0.2276/0.0014 |\n| Dremovecat | tiger | dog: 0.2310/0.2039；horse: 0.2109/0.0273；tiger: 0.2436/0.7174；fox: 0.2173/0.0514 |","sha256":"16d60412e009518b71d22e38b03af09a6a6aafe19dedb059ebc1c7aedca9e6d8","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-2277d769b3f944bfb8a35fe185c93e32","title":"已保存的真实结果：v16 教师 CPU 推理","number":4},"sectionTitle":"已保存的真实结果：v16 教师 CPU 推理","currentQuestion":"已保存的真实结果：v16 教师 CPU 推理","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"table":{"headers":["臂","top-1","候选：cosine / softmax"],"rows":[["臂","top-1","候选：cosine / softmax"],["A_base","cat","cat: 0.2869/0.9958；dog: 0.2310/0.0037；horse: 0.2109/0.0005"],["Bexpandonly","cat","cat: 0.2869/0.9819；dog: 0.2310/0.0037；horse: 0.2109/0.0005；tiger: 0.2436/0.0130；fox: 0.2173/0.0009"],["Cpromptonly","cat","cat: 0.2933/0.9951；dog: 0.2368/0.0035；horse: 0.2276/0.0014"],["Dremovecat","tiger","dog: 0.2310/0.2039；horse: 0.2109/0.0273；tiger: 0.2436/0.7174；fox: 0.2173/0.0514"]]},"previousBlock":"b-5f002549bdef4f3350690cbb","nextBlock":"b-649b822d2f50270f5881eccc","prerequisites":[{"id":"b-f83c06e30511cf60ea488ef2","url":"#b-f83c06e30511cf60ea488ef2","role":"section-title"},{"id":"b-4dfc7ff6e17d4bb63aac9239","url":"#b-4dfc7ff6e17d4bb63aac9239","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-649b822d2f50270f5881eccc","type":"p","scope":"block-e8ab1372e4794474b1dd5aa548d4fe86","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-649b822d2f50270f5881eccc","content":"扩展候选后共享 cosine 保持不变，softmax 分母改变。D 删除 cat 后仍必须选一个；不能把剩余候选中的相对自信当作开放世界正确性。","sha256":"e846288e93259db28b01faa8fceb24f1c74b09dd8638a751a17f2f0b9c8af72a","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-2277d769b3f944bfb8a35fe185c93e32","title":"已保存的真实结果：v16 教师 CPU 推理","number":4},"sectionTitle":"已保存的真实结果：v16 教师 CPU 推理","currentQuestion":"已保存的真实结果：v16 教师 CPU 推理","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-1c9eb656f885ff60c93e792d","nextBlock":null,"prerequisites":[{"id":"b-f83c06e30511cf60ea488ef2","url":"#b-f83c06e30511cf60ea488ef2","role":"section-title"},{"id":"b-4dfc7ff6e17d4bb63aac9239","url":"#b-4dfc7ff6e17d4bb63aac9239","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-6691a622402ba67dbbd730b2","type":"h3","scope":"block-def6f681ce524dbb9da83aa79032d1c8","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-6691a622402ba67dbbd730b2","content":"### 2 · 独立准备并核对预处理","sha256":"1460e216a61fc6c392935c52cbe27c9f5ed079ac2c8e974d85ae0fb0ebbd7466","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-def6f681ce524dbb9da83aa79032d1c8","title":"2 · 独立准备并核对预处理","number":5},"sectionTitle":"2 · 独立准备并核对预处理","currentQuestion":"2 · 独立准备并核对预处理","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-bfc7a5c826ee8ed2bafc8f06","prerequisites":[{"id":"b-bfc7a5c826ee8ed2bafc8f06","url":"#b-bfc7a5c826ee8ed2bafc8f06","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-bfc7a5c826ee8ed2bafc8f06","type":"p","scope":"block-6a9ad60448b840d8acee32a8714ebc3d","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-bfc7a5c826ee8ed2bafc8f06","content":"在当前项目准备 `lab10-clip/` 并安装其中的 `requirements.txt`。小配置文件随包附带，代码将逐个校验。默认只进行图像/文字预处理；需要重做模型推理时，再从本目录运行 `python fetch_clip.py` 下载固定 revision 的公开权重（约 600 MB）。本轮不要求下载或运行模型。","sha256":"3c284f394e9da76c043b0ce26f0de75b6a6c01df6c3ed6856cb5b48d7072ec20","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-def6f681ce524dbb9da83aa79032d1c8","title":"2 · 独立准备并核对预处理","number":5},"sectionTitle":"2 · 独立准备并核对预处理","currentQuestion":"2 · 独立准备并核对预处理","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-6691a622402ba67dbbd730b2","nextBlock":"b-5d04f9519470deb6dc1abb4a","prerequisites":[{"id":"b-6691a622402ba67dbbd730b2","url":"#b-6691a622402ba67dbbd730b2","role":"section-title"}],"relatedBlocks":[]},{"id":"b-5d04f9519470deb6dc1abb4a","type":"pre","scope":"block-aaa45a4607af423da4c9144dad703b56","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-5d04f9519470deb6dc1abb4a","content":"```\n# 当前项目中的独立材料：已存在则复用，缺失才从本讲原站准备。\nfrom pathlib import Path\nimport io, zipfile, requests\n_base = Path.cwd()\n_folder = 'lab10-clip'\n_sentinel = 'assets/chelsea-cat.png'\n_choices = [_base/_folder, _base/'lecture03-labs'/_folder, _base]\n_ready = next((p for p in _choices if (p/_sentinel).is_file()), None)\nif _ready is None:\n    _url = 'https://codingai-lec03.pages.dev/course/materials/' + _folder + '.zip'\n    _response = requests.get(_url, timeout=60)\n    _response.raise_for_status()\n    _payload = _response.content\n    with zipfile.ZipFile(io.BytesIO(_payload)) as _archive:\n        _names = [i.filename for i in _archive.infolist() if not i.is_dir()]\n        _prefix = _folder + '/'\n        _prefixed = all(n.startswith(_prefix) for n in _names)\n        _destination = _base if _prefixed else _base/_folder\n        for _item in _archive.infolist():\n            _target = (_destination/_item.filename).resolve()\n            if not _target.is_relative_to(_destination.resolve()):\n                raise ValueError('材料包中有越界路径，停止解压。')\n            if _item.is_dir():\n                _target.mkdir(parents=True, exist_ok=True)\n            elif not _target.exists():\n                _target.parent.mkdir(parents=True, exist_ok=True)\n                _target.write_bytes(_archive.read(_item))\n    _ready = next((p for p in _choices if (p/_sentinel).is_file()), None)\nassert _ready is not None, '请将本讲完整材料包解压到当前项目的 ' + _folder + '/；保留文件结构。'\nLAB_ROOT = _ready\nprint('材料目录已就绪：', LAB_ROOT)\n\nimport json, hashlib, platform, sys\nfrom pathlib import Path\nimport numpy as np\nimport matplotlib.pyplot as plt\nROOT=LAB_ROOT\nif not (ROOT/'assets').is_dir() and (ROOT/'lab10-clip'/'assets').is_dir():ROOT=ROOT/'lab10-clip'\nassert (ROOT/'assets').is_dir(), '请解压本实验完整包，并在该目录或其父目录运行。'\nOUT=ROOT/'runs/current'; OUT.mkdir(parents=True,exist_ok=True)\nFIG=OUT/'figures'; FIG.mkdir(exist_ok=True)\nplt.rcParams.update({'figure.dpi':120,'font.size':10,'axes.spines.top':False,'axes.spines.right':False})\nBLUE,GOLD,GREEN,PURPLE='#002676','#E6A500','#00856A','#69458D'\ndef sha_file(path):return hashlib.sha256(Path(path).read_bytes()).hexdigest()\ndef savefig(name):\n    if not plt.gcf().get_constrained_layout():plt.tight_layout()\n    plt.savefig(FIG/name,dpi=140,bbox_inches='tight');plt.show()\n\nimport torch\nfrom PIL import Image\n# 若宿主缺少固定预处理依赖，仅装入本次临时目录；不修改项目环境或下载模型权重。\nimport importlib.util, importlib.metadata, subprocess\ntry:\n    _transformers_version=importlib.metadata.version('transformers')\nexcept importlib.metadata.PackageNotFoundError:\n    _transformers_version=None\nif _transformers_version!='4.57.1':\n    _deps=ROOT/'_temporary_preprocessing_dependencies'\n    subprocess.check_call([sys.executable,'-m','pip','install','--quiet','--disable-pip-version-check',\n                           '--no-cache-dir','--target',str(_deps),'transformers==4.57.1',\n                           'numpy=='+np.__version__,'filelock>=3.20.3,<4'])\n    sys.path.insert(0,str(_deps))\n    importlib.invalidate_caches()\nfrom transformers import CLIPProcessor,CLIPImageProcessor,AutoTokenizer\nimport transformers\nassert transformers.__version__=='4.57.1', '请使用包内固定 requirements.txt。'\ntorch.set_num_threads(2)\nprovenance=json.loads((ROOT/'assets/provenance.json').read_text())\nassert sha_file(ROOT/'assets/chelsea-cat.png')==provenance['image_sha256']\nREVISION=provenance['revision']\nlocal=ROOT/'.model-cache'/REVISION\nconfig_local=ROOT/'model-config'\n# small verified config files ship in the package; weights are downloaded only on request.\nmanifest=json.loads((config_local/'manifest.json').read_text())\nfor f,expected in manifest['sha256'].items():assert sha_file(config_local/f)==expected\nclip_processor=CLIPProcessor(image_processor=CLIPImageProcessor.from_pretrained(config_local,local_files_only=True),tokenizer=AutoTokenizer.from_pretrained(config_local,local_files_only=True,use_fast=True))\nphoto=Image.open(ROOT/'assets/chelsea-cat.png').convert('RGB')\narms={'A_base':(['cat','dog','horse'],'a photo of a {}.'),'B_expand_only':(['cat','dog','horse','tiger','fox'],'a photo of a {}.'),'C_prompt_only':(['cat','dog','horse'],'a cropped photo of a {}.'),'D_remove_cat':(['dog','horse','tiger','fox'],'a photo of a {}.')}\nimage_inputs=clip_processor(images=photo,return_tensors='pt')\nall_prompts=list(dict.fromkeys(template.format(name) for names,template in arms.values() for name in names))\ntext_inputs=clip_processor(text=all_prompts,padding=True,return_tensors='pt')\nassert tuple(image_inputs['pixel_values'].shape)==(1,3,224,224)\nassert clip_processor.image_processor.__class__.__name__=='CLIPImageProcessor'\nassert clip_processor.tokenizer.__class__.__name__=='CLIPTokenizerFast'\npreprocess_verification={'scope':'preprocessing only, no weights loaded','pixel_shape':list(image_inputs['pixel_values'].shape),'pixel_sha256':hashlib.sha256(image_inputs['pixel_values'].numpy().tobytes()).hexdigest(),'prompt_count':len(all_prompts),'tokenizer':clip_processor.tokenizer.__class__.__name__,'image_processor':clip_processor.image_processor.__class__.__name__,'transformers':transformers.__version__,'image_sha256':sha_file(ROOT/'assets/chelsea-cat.png'),'revision':REVISION}\nhistorical_preprocess=json.loads((ROOT/'historical-v16/results/preprocessing-audit-20260918.json').read_text())\nassert preprocess_verification['pixel_sha256']==historical_preprocess['pixel_values_sha256']\nlegacy_processor=CLIPProcessor.from_pretrained(config_local,local_files_only=True)\nlegacy_image=legacy_processor(images=photo,return_tensors='pt')\nlegacy_text=legacy_processor(text=all_prompts,padding=True,return_tensors='pt')\nassert torch.equal(legacy_image['pixel_values'],image_inputs['pixel_values'])\nassert all(torch.equal(legacy_text[k],text_inputs[k]) for k in text_inputs)\npreprocess_verification['legacy_default_pixel_max_abs_difference']=float((legacy_image['pixel_values']-image_inputs['pixel_values']).abs().max())\npreprocess_verification['all_prompt_token_tensors_equal']=True\npreprocess_verification['token_ids_sha256']=hashlib.sha256(text_inputs['input_ids'].numpy().tobytes()).hexdigest()\n(OUT/'preprocessing-verification.json').write_text(json.dumps(preprocess_verification,indent=2));print(json.dumps(preprocess_verification,indent=2))\n\n```","sha256":"b49cd167f2cd93fe7431aea28959a8acf1559bfe30fb63d65ca0078b3ba9b785","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-def6f681ce524dbb9da83aa79032d1c8","title":"2 · 独立准备并核对预处理","number":5},"sectionTitle":"2 · 独立准备并核对预处理","currentQuestion":"2 · 独立准备并核对预处理","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-bfc7a5c826ee8ed2bafc8f06","nextBlock":"b-033489d7b7cdd39d6e69d075","prerequisites":[{"id":"b-6691a622402ba67dbbd730b2","url":"#b-6691a622402ba67dbbd730b2","role":"section-title"},{"id":"b-bfc7a5c826ee8ed2bafc8f06","url":"#b-bfc7a5c826ee8ed2bafc8f06","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-033489d7b7cdd39d6e69d075","type":"p","scope":"block-fe26b27f069b4605aa4f794f6c8b4fcc","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-033489d7b7cdd39d6e69d075","content":"**本地保存输出（非 Deepnote 云端运行）**","sha256":"299dde2261afc779a24cf1ae75d95db124c4172bdc20f07be698f22dadfa7947","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-def6f681ce524dbb9da83aa79032d1c8","title":"2 · 独立准备并核对预处理","number":5},"sectionTitle":"2 · 独立准备并核对预处理","currentQuestion":"2 · 独立准备并核对预处理","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-5d04f9519470deb6dc1abb4a","nextBlock":"b-f2b2d8417c6958fcb1086832","prerequisites":[{"id":"b-6691a622402ba67dbbd730b2","url":"#b-6691a622402ba67dbbd730b2","role":"section-title"},{"id":"b-bfc7a5c826ee8ed2bafc8f06","url":"#b-bfc7a5c826ee8ed2bafc8f06","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-f2b2d8417c6958fcb1086832","type":"pre","scope":"block-fe26b27f069b4605aa4f794f6c8b4fcc","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-f2b2d8417c6958fcb1086832","content":"```\nUsing a slow image processor as `use_fast` is unset and a slow processor was saved with this model. `use_fast=True` will be the default behavior in v4.52, even if the model was saved with a slow processor. This will result in minor differences in outputs. You'll still be able to use a slow processor with `use_fast=False`.\n{\n  \"scope\": \"preprocessing only, no weights loaded\",\n  \"pixel_shape\": [\n    1,\n    3,\n    224,\n    224\n  ],\n  \"pixel_sha256\": \"59ba65f37c29915984addd8e4d8856f9c1579c284af0ef0260bc4f25eadbbab9\",\n  \"prompt_count\": 8,\n  \"tokenizer\": \"CLIPTokenizerFast\",\n  \"image_processor\": \"CLIPImageProcessor\",\n  \"transformers\": \"4.57.1\",\n  \"image_sha256\": \"596aa1e7cb875eb79f437e310381d26b338a81c2da23439704a73c4651e8c4bb\",\n  \"revision\": \"3d74acf9a28c67741b2f4f2ea7635f0aaf6f0268\",\n  \"legacy_default_pixel_max_abs_difference\": 0.0,\n  \"all_prompt_token_tensors_equal\": true,\n  \"token_ids_sha256\": \"b51f79cb2f07674c29ec6589bd5bc2f1537e340cfc6c78f567d3d09481d2a902\"\n}\n\n```","sha256":"dff19488e6f8888405f2823c59d4a3766072b0b85e025b7f28149516e0dfd52d","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-def6f681ce524dbb9da83aa79032d1c8","title":"2 · 独立准备并核对预处理","number":5},"sectionTitle":"2 · 独立准备并核对预处理","currentQuestion":"2 · 独立准备并核对预处理","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-033489d7b7cdd39d6e69d075","nextBlock":null,"prerequisites":[{"id":"b-6691a622402ba67dbbd730b2","url":"#b-6691a622402ba67dbbd730b2","role":"section-title"},{"id":"b-bfc7a5c826ee8ed2bafc8f06","url":"#b-bfc7a5c826ee8ed2bafc8f06","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-f7bc425e4c52c19843051680","type":"h3","scope":"block-7203294161d5450497543d518d80ed6d","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-f7bc425e4c52c19843051680","content":"### 3 · 可选：固定模型，重算四个候选条件","sha256":"6def08c32b253314741f0d8207cc72a2de517cdf2ede4ebf2bd41c9b12b36fd4","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-7203294161d5450497543d518d80ed6d","title":"3 · 可选：固定模型，重算四个候选条件","number":6},"sectionTitle":"3 · 可选：固定模型，重算四个候选条件","currentQuestion":"3 · 可选：固定模型，重算四个候选条件","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-8d8bf785574c000b4391ac04","prerequisites":[{"id":"b-8d8bf785574c000b4391ac04","url":"#b-8d8bf785574c000b4391ac04","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-8d8bf785574c000b4391ac04","type":"p","scope":"block-d8044a8e957c429c957ef7f6c29f71cc","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-8d8bf785574c000b4391ac04","content":"默认 `RUN_CLIP=False`，保留猫图历史分数供阅读。若自行重做推理：先准备固定权重，再改为 True，顺序运行。新输出只写 `runs/current/`。只完成预处理不表示已经完成模型推理。","sha256":"8e747f8fbed7789631a4090e72c711a840e333ac2f73d4e3552fb97b9d603122","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-7203294161d5450497543d518d80ed6d","title":"3 · 可选：固定模型，重算四个候选条件","number":6},"sectionTitle":"3 · 可选：固定模型，重算四个候选条件","currentQuestion":"3 · 可选：固定模型，重算四个候选条件","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-f7bc425e4c52c19843051680","nextBlock":"b-8f9af9d2c59465556fcfcdbc","prerequisites":[{"id":"b-f7bc425e4c52c19843051680","url":"#b-f7bc425e4c52c19843051680","role":"section-title"}],"relatedBlocks":[]},{"id":"b-8f9af9d2c59465556fcfcdbc","type":"pre","scope":"block-07786a60d0614351a320e5da4ea0ef2d","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-8f9af9d2c59465556fcfcdbc","content":"```\nRUN_CLIP=False  # 已下载固定权重后改 True；默认只核对准备与预处理。\nif RUN_CLIP:\n    from transformers import CLIPModel, CLIPProcessor, CLIPImageProcessor, AutoTokenizer\n    from PIL import Image\n    REVISION='3d74acf9a28c67741b2f4f2ea7635f0aaf6f0268'\n    local=ROOT/'.model-cache'/REVISION\n    assert (local/'pytorch_model.bin').exists(), '先运行 python fetch_clip.py；本单元不伪造相似度。'\n    assert sha_file(local/'pytorch_model.bin')==provenance['model_sha256'], '权重 SHA-256 不匹配，停止。'\n    clip_model=CLIPModel.from_pretrained(local,local_files_only=True).eval()\n    # Make the teacher run's slow image processing + fast tokenizer explicit.\n    # A shared use_fast=False would also change the tokenizer; keep each choice separate.\n    clip_processor=CLIPProcessor(\n        image_processor=CLIPImageProcessor.from_pretrained(local,local_files_only=True),\n        tokenizer=AutoTokenizer.from_pretrained(local,local_files_only=True,use_fast=True))\n    for parameter in clip_model.parameters():parameter.requires_grad_(False)\n    photo=Image.open(ROOT/'assets/chelsea-cat.png').convert('RGB')\n    image_inputs=clip_processor(images=photo,return_tensors='pt')\n    arms={\n      'A_base':(['cat','dog','horse'],'a photo of a {}.'),\n      'B_expand_only':(['cat','dog','horse','tiger','fox'],'a photo of a {}.'),\n      'C_prompt_only':(['cat','dog','horse'],'a cropped photo of a {}.'),\n      'D_remove_cat':(['dog','horse','tiger','fox'],'a photo of a {}.')}\n    clip_records={}\n    with torch.no_grad():\n        image_feature=clip_model.get_image_features(**image_inputs)\n        image_feature=image_feature/image_feature.norm(dim=-1,keepdim=True)\n        scale=float(clip_model.logit_scale.exp())\n        for arm,(names,template) in arms.items():\n            prompts=[template.format(name) for name in names]\n            text_inputs=clip_processor(text=prompts,return_tensors='pt',padding=True)\n            text_features=clip_model.get_text_features(**text_inputs)\n            text_features=text_features/text_features.norm(dim=-1,keepdim=True)\n            cosine=(image_feature@text_features.T).squeeze(0)\n            probabilities=(cosine*scale).softmax(-1)\n            clip_records[arm]={'candidate_names':names,'prompts':prompts,'cosine':cosine.tolist(),\n              'softmax':probabilities.tolist(),'top1':names[int(cosine.argmax())]}\n    assert np.allclose(clip_records['A_base']['cosine'],clip_records['B_expand_only']['cosine'][:3],atol=2e-6)\n    clip_result={'status':'actually run locally on CPU','model_repo':'openai/clip-vit-base-patch32','revision':REVISION,\n      'model_sha256':sha_file(local/'pytorch_model.bin'),'image_sha256':sha_file(ROOT/'assets/chelsea-cat.png'),\n      'image_source':'scikit-image v0.25.2 chelsea.png; Stefan van der Walt; CC0','logit_scale':scale,\n      'arms':clip_records,'limitations':['one image; no dataset-level accuracy estimate','relative candidate scores are not open-set certainty']}\n    (OUT/'clip-results.json').write_text(json.dumps(clip_result,indent=2))\n    fig,axes=plt.subplots(1,3,figsize=(12,3.8));axes[0].imshow(photo);axes[0].axis('off');axes[0].set_title('Same real photograph in all arms')\n    for arm,color in [('A_base',BLUE),('B_expand_only',GOLD)]:\n        rr=clip_records[arm]; loc=np.arange(len(rr['candidate_names']))\n        axes[1].plot(loc,rr['cosine'],marker='o',label=arm,color=color)\n        axes[2].plot(loc,rr['softmax'],marker='o',label=arm,color=color)\n    for ax,title in zip(axes[1:],['Shared cosine remains fixed','Relative softmax changes']):\n        ax.set(xticks=range(5),xticklabels=arms['B_expand_only'][0],title=title);ax.legend(fontsize=8);ax.grid(alpha=.18)\n    axes[1].set_ylabel('Cosine similarity');axes[2].set_ylabel('Softmax over chosen candidates')\n    savefig('05-clip-candidates.png')\n    print('Actual checkpoint SHA-256:',clip_result['model_sha256'])\n    print('arm | top1 | candidate : cosine / softmax')\n    for arm,r in clip_records.items():\n        print(arm,r['top1'],[(name,round(co,4),round(pr,4)) for name,co,pr in zip(r['candidate_names'],r['cosine'],r['softmax'])])\nelse:\n    print('CLIP 未运行：请不要将空结果写成真实相似度。')\n```","sha256":"230d2735d75681058289c5ed8cba5733565164e34ad5d90cb2ee8331665da334","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-7203294161d5450497543d518d80ed6d","title":"3 · 可选：固定模型，重算四个候选条件","number":6},"sectionTitle":"3 · 可选：固定模型，重算四个候选条件","currentQuestion":"3 · 可选：固定模型，重算四个候选条件","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-8d8bf785574c000b4391ac04","nextBlock":"b-351ab093f0c04304382d755e","prerequisites":[{"id":"b-f7bc425e4c52c19843051680","url":"#b-f7bc425e4c52c19843051680","role":"section-title"},{"id":"b-8d8bf785574c000b4391ac04","url":"#b-8d8bf785574c000b4391ac04","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-351ab093f0c04304382d755e","type":"p","scope":"block-8249b79b5c814406ad65261d54ff139e","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-351ab093f0c04304382d755e","content":"**本地保存输出（非 Deepnote 云端运行）**","sha256":"299dde2261afc779a24cf1ae75d95db124c4172bdc20f07be698f22dadfa7947","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-7203294161d5450497543d518d80ed6d","title":"3 · 可选：固定模型，重算四个候选条件","number":6},"sectionTitle":"3 · 可选：固定模型，重算四个候选条件","currentQuestion":"3 · 可选：固定模型，重算四个候选条件","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-8f9af9d2c59465556fcfcdbc","nextBlock":"b-381503e1bb93bb474863c1c8","prerequisites":[{"id":"b-f7bc425e4c52c19843051680","url":"#b-f7bc425e4c52c19843051680","role":"section-title"},{"id":"b-8d8bf785574c000b4391ac04","url":"#b-8d8bf785574c000b4391ac04","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-381503e1bb93bb474863c1c8","type":"pre","scope":"block-8249b79b5c814406ad65261d54ff139e","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-381503e1bb93bb474863c1c8","content":"```\nCLIP 未运行：请不要将空结果写成真实相似度。\n\n```","sha256":"153cee9f8061cd6424bc0699b4d904c6769236d684d0590ad42ba59aa6f46ce4","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-7203294161d5450497543d518d80ed6d","title":"3 · 可选：固定模型，重算四个候选条件","number":6},"sectionTitle":"3 · 可选：固定模型，重算四个候选条件","currentQuestion":"3 · 可选：固定模型，重算四个候选条件","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-351ab093f0c04304382d755e","nextBlock":null,"prerequisites":[{"id":"b-f7bc425e4c52c19843051680","url":"#b-f7bc425e4c52c19843051680","role":"section-title"},{"id":"b-8d8bf785574c000b4391ac04","url":"#b-8d8bf785574c000b4391ac04","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-8bbab072b41ee812211fc13d","type":"h3","scope":"block-30b2d43a6e3247dbace306ecfe1c52bb","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-8bbab072b41ee812211fc13d","content":"### 4 · 只改一个条件","sha256":"fceca1c52ec155a2f29246eebfe581d3fbb61de9458ca8c59f36e5371c093541","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-30b2d43a6e3247dbace306ecfe1c52bb","title":"4 · 只改一个条件","number":7},"sectionTitle":"4 · 只改一个条件","currentQuestion":"4 · 只改一个条件","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-9ec66450d66b9b5b6e69849d","prerequisites":[{"id":"b-9ec66450d66b9b5b6e69849d","url":"#b-9ec66450d66b9b5b6e69849d","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-9ec66450d66b9b5b6e69849d","type":"p","scope":"block-7e3ca724e5f44834b4dce2877cb743e6","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-9ec66450d66b9b5b6e69849d","content":"让 AI 只增加一个候选名；核对照片、模型 revision、预处理和旧 prompt 未改变，再比较共享候选 cosine 与新的 softmax。或只改同一候选集的描述模板。二者不要同时改变。","sha256":"9745219605a12e01d5aa422c63970dcc27eb1501f1d73625b63f31e6e3a7f277","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-30b2d43a6e3247dbace306ecfe1c52bb","title":"4 · 只改一个条件","number":7},"sectionTitle":"4 · 只改一个条件","currentQuestion":"4 · 只改一个条件","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-8bbab072b41ee812211fc13d","nextBlock":"b-c8ac033032bd0d789d99afd8","prerequisites":[{"id":"b-8bbab072b41ee812211fc13d","url":"#b-8bbab072b41ee812211fc13d","role":"section-title"}],"relatedBlocks":[]},{"id":"b-c8ac033032bd0d789d99afd8","type":"p","scope":"block-7e3ca724e5f44834b4dce2877cb743e6","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-c8ac033032bd0d789d99afd8","content":"一张照片不提供数据集级准确率；预训练不是本实验复现对象，图文匹配也不是 captioning 或 text-to-image。","sha256":"c1def692c27ca829d3649ef30205720c238b601dbc08d56678be2cfd3d76e4e1","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-30b2d43a6e3247dbace306ecfe1c52bb","title":"4 · 只改一个条件","number":7},"sectionTitle":"4 · 只改一个条件","currentQuestion":"4 · 只改一个条件","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-9ec66450d66b9b5b6e69849d","nextBlock":"b-8bae31ae56e65bb31620f9d0","prerequisites":[{"id":"b-8bbab072b41ee812211fc13d","url":"#b-8bbab072b41ee812211fc13d","role":"section-title"},{"id":"b-9ec66450d66b9b5b6e69849d","url":"#b-9ec66450d66b9b5b6e69849d","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-8bae31ae56e65bb31620f9d0","type":"pre","scope":"block-4a7cd45fd86549e5b31fee86f6949ab3","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-8bae31ae56e65bb31620f9d0","content":"```\n# 当前单元无法确认宿主平台或是否使用全新进程；unknown 不等于 False。\nverification={'identity':'v17 independent CLIP candidates','fresh_process':'unknown','preprocessing_actually_run':True,'clip_model_inference_actually_run':RUN_CLIP,'mnist_loaded':False,'cnn_loaded':False,'cloud_run':'unknown','historical_inference':'v16 saved CPU result; not this execution','revision':REVISION,'environment':{'python':platform.python_version(),'torch':torch.__version__,'transformers':transformers.__version__}}\n(OUT/'verification.json').write_text(json.dumps(verification,indent=2));print(json.dumps(verification,indent=2))\n\n```","sha256":"4de0e67d674b8d4e079a576c58ad3e7b5657a86ff8f83fab386dc93cb39911ee","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-30b2d43a6e3247dbace306ecfe1c52bb","title":"4 · 只改一个条件","number":7},"sectionTitle":"4 · 只改一个条件","currentQuestion":"4 · 只改一个条件","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-c8ac033032bd0d789d99afd8","nextBlock":"b-eb0025b322d1a43d9bc45fd4","prerequisites":[{"id":"b-8bbab072b41ee812211fc13d","url":"#b-8bbab072b41ee812211fc13d","role":"section-title"},{"id":"b-9ec66450d66b9b5b6e69849d","url":"#b-9ec66450d66b9b5b6e69849d","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-eb0025b322d1a43d9bc45fd4","type":"p","scope":"block-f49cbfdaf72c4e6a9129f660c465f555","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-eb0025b322d1a43d9bc45fd4","content":"**本地保存输出（非 Deepnote 云端运行）**","sha256":"299dde2261afc779a24cf1ae75d95db124c4172bdc20f07be698f22dadfa7947","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-30b2d43a6e3247dbace306ecfe1c52bb","title":"4 · 只改一个条件","number":7},"sectionTitle":"4 · 只改一个条件","currentQuestion":"4 · 只改一个条件","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-8bae31ae56e65bb31620f9d0","nextBlock":"b-4ba01b4b2724768b71ec1a8f","prerequisites":[{"id":"b-8bbab072b41ee812211fc13d","url":"#b-8bbab072b41ee812211fc13d","role":"section-title"},{"id":"b-9ec66450d66b9b5b6e69849d","url":"#b-9ec66450d66b9b5b6e69849d","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-4ba01b4b2724768b71ec1a8f","type":"pre","scope":"block-f49cbfdaf72c4e6a9129f660c465f555","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-4ba01b4b2724768b71ec1a8f","content":"```\n{\n  \"identity\": \"v17 independent CLIP candidates\",\n  \"fresh_process\": true,\n  \"preprocessing_actually_run\": true,\n  \"clip_model_inference_actually_run\": false,\n  \"mnist_loaded\": false,\n  \"cnn_loaded\": false,\n  \"cloud_run\": false,\n  \"historical_inference\": \"v16 saved CPU result; not this execution\",\n  \"revision\": \"3d74acf9a28c67741b2f4f2ea7635f0aaf6f0268\",\n  \"environment\": {\n    \"python\": \"3.12.14\",\n    \"torch\": \"2.14.0+cpu\",\n    \"transformers\": \"4.57.1\"\n  }\n}\n\n```","sha256":"09ae1a67c6c83e255ec18e1aaa206c29f2382c975316158db8241fc238d797d0","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-30b2d43a6e3247dbace306ecfe1c52bb","title":"4 · 只改一个条件","number":7},"sectionTitle":"4 · 只改一个条件","currentQuestion":"4 · 只改一个条件","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-eb0025b322d1a43d9bc45fd4","nextBlock":null,"prerequisites":[{"id":"b-8bbab072b41ee812211fc13d","url":"#b-8bbab072b41ee812211fc13d","role":"section-title"},{"id":"b-9ec66450d66b9b5b6e69849d","url":"#b-9ec66450d66b9b5b6e69849d","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-a27e876fed1f0765d4e4d354","type":"h2","scope":"block-4f42285447374de387bf748b74f29f7f","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-a27e876fed1f0765d4e4d354","content":"## 5 · 2026-09-22 保存实测：固定权重复核与关系分数","sha256":"f21fd442d22569deda7beed517ab481920302a21cbd52139c0ba858e0015d97a","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-4f42285447374de387bf748b74f29f7f","title":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","number":8},"sectionTitle":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","currentQuestion":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-ee7152cf526695e7efa9a46f","prerequisites":[{"id":"b-ee7152cf526695e7efa9a46f","url":"#b-ee7152cf526695e7efa9a46f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-ee7152cf526695e7efa9a46f","type":"p","scope":"block-4f42285447374de387bf748b74f29f7f","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-ee7152cf526695e7efa9a46f","content":"此前的猫图实验已经包含真实模型，值得复用。2026-09-22 的修复从原站源码 `bbf8a78` 的 `course/materials/lab10-clip.zip` 恢复照片、固定配置、旧结果和 provenance，未把旧分数换成新日期。随后在本地全新 Python 进程实际载入同一 CLIP ViT-B/32 checkpoint，完成图像编码、文字编码、归一化和相似度；没有重新训练 CLIP。","sha256":"e85f736391eb22f95851f32279f2e9d6cc466bb40e5e7001fe48a832b093af91","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-4f42285447374de387bf748b74f29f7f","title":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","number":8},"sectionTitle":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","currentQuestion":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-a27e876fed1f0765d4e4d354","nextBlock":"b-aac40eaa877e5720f8bd850c","prerequisites":[{"id":"b-a27e876fed1f0765d4e4d354","url":"#b-a27e876fed1f0765d4e4d354","role":"section-title"}],"relatedBlocks":[]},{"id":"b-aac40eaa877e5720f8bd850c","type":"p","scope":"block-4f42285447374de387bf748b74f29f7f","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-aac40eaa877e5720f8bd850c","content":"权重 revision 为 `3d74acf9a28c67741b2f4f2ea7635f0aaf6f0268`，权重 SHA-256 为 `a63082132ba4f97a80bea76823f544493bffa8082296d62d71581a4feff1576f`。真实猫图的预处理张量 SHA 与旧记录一致，四臂全部 cosine 与旧输出的最大绝对差为 **1.0431×10⁻⁷**。这项复核支持“使用相同输入和模型得到相同分数”，不把一个样本的成功扩大为模型总体准确率。","sha256":"560e1ce7de2f6d5a82f207259d27b2235296af34df0fb4edb840762408393593","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-4f42285447374de387bf748b74f29f7f","title":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","number":8},"sectionTitle":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","currentQuestion":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-ee7152cf526695e7efa9a46f","nextBlock":"b-e4c4bb9bc4745a40850c8549","prerequisites":[{"id":"b-a27e876fed1f0765d4e4d354","url":"#b-a27e876fed1f0765d4e4d354","role":"section-title"},{"id":"b-ee7152cf526695e7efa9a46f","url":"#b-ee7152cf526695e7efa9a46f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-e4c4bb9bc4745a40850c8549","type":"p","scope":"block-4f42285447374de387bf748b74f29f7f","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-e4c4bb9bc4745a40850c8549","content":"[完整代码、输入、缓存和 2026-09-22 输出](/course/materials/lecture03-clip-retrieval.zip)，下载解压后先安装 `requirements-cache.txt`。缓存阅读和检索无需下载 605 MB 权重。若要在自己的环境重算编码，安装 `requirements-inference.txt`，执行 `python fetch_clip.py`，再执行 `python run_clip_retrieval.py --encode`。固定权重哈希错误会停止，下载失败不会伪造分数。新运行进入新的 UTC 时间目录。","sha256":"8c0fd90086274679639f315bfd72e859819f0499ec7a8edfbf076c7e9f007774","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-4f42285447374de387bf748b74f29f7f","title":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","number":8},"sectionTitle":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","currentQuestion":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-aac40eaa877e5720f8bd850c","nextBlock":"b-60a3cf2a1a6a9fd5bbd8f01e","prerequisites":[{"id":"b-a27e876fed1f0765d4e4d354","url":"#b-a27e876fed1f0765d4e4d354","role":"section-title"},{"id":"b-ee7152cf526695e7efa9a46f","url":"#b-ee7152cf526695e7efa9a46f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-60a3cf2a1a6a9fd5bbd8f01e","type":"pre","scope":"block-facd5784eb654f089d7c523bab835dce","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-60a3cf2a1a6a9fd5bbd8f01e","content":"```\n# 独立材料，不依赖另一册 notebook 的内存；重复运行复用本项目已下载内容。\nfrom pathlib import Path\nimport io, json, zipfile, requests, sys, hashlib\n_candidates=[Path.cwd()/'lecture03-clip-retrieval', Path.cwd()]\nRETRIEVAL_ROOT=next((p for p in _candidates if (p/'cache/clip-features.npz').exists()),None)\nif RETRIEVAL_ROOT is None:\n    _response=requests.get('https://codingai-lec03.pages.dev/course/materials/lecture03-clip-retrieval.zip',timeout=60)\n    _response.raise_for_status()\n    _data=_response.content\n    print('下载材料 ZIP:',len(_data),'bytes; SHA256',hashlib.sha256(_data).hexdigest())\n    with zipfile.ZipFile(io.BytesIO(_data)) as z:\n        for info in z.infolist():\n            target=(Path.cwd()/info.filename).resolve()\n            assert target.is_relative_to(Path.cwd().resolve()), '拒绝越界路径'\n            if info.is_dir():target.mkdir(parents=True,exist_ok=True)\n            elif not target.exists():\n                target.parent.mkdir(parents=True,exist_ok=True);target.write_bytes(z.read(info))\n    RETRIEVAL_ROOT=Path.cwd()/'lecture03-clip-retrieval'\nassert (RETRIEVAL_ROOT/'cache/provenance.json').is_file()\nsys.path.insert(0,str(RETRIEVAL_ROOT))\nimport run_clip_retrieval as cr\nimport numpy as np\np=json.loads((RETRIEVAL_ROOT/'cache/provenance.json').read_text())\nassert cr.sha(RETRIEVAL_ROOT/'cache/clip-features.npz')==p['cache_sha256']\nassert cr.sha(RETRIEVAL_ROOT/'assets/manifest.json')==p['manifest_sha256']\nmanifest=json.loads((RETRIEVAL_ROOT/'assets/manifest.json').read_text())\nfor r in manifest['gallery']+manifest['relation']+manifest['holder']:\n    assert cr.sha(RETRIEVAL_ROOT/r['path'])==r['sha256']\na=np.load(RETRIEVAL_ROOT/'cache/clip-features.npz')\nprint('已核验真实 CLIP 缓存；生成时间',p['generated_at_utc'])\nprint('本格只载入缓存，没有在当前 notebook 运行 CLIP 编码器。')\nprint('gallery, queries:',a['gallery'].shape,a['queries'].shape)\n\n```","sha256":"3d32c29794a1b985da1ce28a5c69a139c3d4040422600609c15a1f81f9536114","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-4f42285447374de387bf748b74f29f7f","title":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","number":8},"sectionTitle":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","currentQuestion":"5 · 2026-09-22 保存实测：固定权重复核与关系分数","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-e4c4bb9bc4745a40850c8549","nextBlock":null,"prerequisites":[{"id":"b-a27e876fed1f0765d4e4d354","url":"#b-a27e876fed1f0765d4e4d354","role":"section-title"},{"id":"b-ee7152cf526695e7efa9a46f","url":"#b-ee7152cf526695e7efa9a46f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-719e26a4931ee20702889e9e","type":"h3","scope":"block-e8d09daa81304bbebf6af1b6be1d73f0","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-719e26a4931ee20702889e9e","content":"### 预处理和两条编码支路到底做了什么？","sha256":"4227d215a5365c216c591d138650d0074d422406d52d369b938da2510c55ecb8","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-e8d09daa81304bbebf6af1b6be1d73f0","title":"预处理和两条编码支路到底做了什么？","number":9},"sectionTitle":"预处理和两条编码支路到底做了什么？","currentQuestion":"预处理和两条编码支路到底做了什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-a009ac66ccd160075a3ca3ea","prerequisites":[{"id":"b-a009ac66ccd160075a3ca3ea","url":"#b-a009ac66ccd160075a3ca3ea","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-a009ac66ccd160075a3ca3ea","type":"p","scope":"block-e8d09daa81304bbebf6af1b6be1d73f0","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-a009ac66ccd160075a3ca3ea","content":"图像先转 RGB，以 bicubic 将短边缩放至 224，再中心裁剪为 224×224，使用 checkpoint 指定的均值和标准差归一化。文本用固定 `CLIPTokenizerFast` 产生 token IDs、起止标记和 padding；本例短句没有超过 77-token 上限。图像批次是 `[B,3,224,224]`，文字批次是 `[Q,L]`，两个编码器的输出均投影为 512 维。它们随后分别除以 L2 范数；这一步之后点积才等于 cosine。","sha256":"551b29c91d6c2e964eb6f0864175d1a3cae486550e57203367929de82204e36d","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-e8d09daa81304bbebf6af1b6be1d73f0","title":"预处理和两条编码支路到底做了什么？","number":9},"sectionTitle":"预处理和两条编码支路到底做了什么？","currentQuestion":"预处理和两条编码支路到底做了什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-719e26a4931ee20702889e9e","nextBlock":"b-fd359739b0bf453286709c4f","prerequisites":[{"id":"b-719e26a4931ee20702889e9e","url":"#b-719e26a4931ee20702889e9e","role":"section-title"}],"relatedBlocks":[]},{"id":"b-fd359739b0bf453286709c4f","type":"p","scope":"block-e8d09daa81304bbebf6af1b6be1d73f0","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-fd359739b0bf453286709c4f","content":"设图像、文字特征为 $v_i,t_j$，归一化后的分数为 $s_{ij}=v_i^\\top t_j$。候选内分布 $p(j|i,\\mathcal C)=\\exp(\\alpha s_{ij})/\\sum_{k\\in\\mathcal C}\\exp(\\alpha s_{ik})$ 还需要固定模型的 $\\alpha$，本 checkpoint 为约 100。A→B 改变分母，A→C 改变 token 和文本特征；B→D 删除了正确答案。三种干预不能混为“模型概率变了”。","sha256":"59d972b7a7945ded7b62c614dc541e82d259c17a4b3cd968a54d03da8a101b7f","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-e8d09daa81304bbebf6af1b6be1d73f0","title":"预处理和两条编码支路到底做了什么？","number":9},"sectionTitle":"预处理和两条编码支路到底做了什么？","currentQuestion":"预处理和两条编码支路到底做了什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[{"latex":"v_i,t_j","definitionContext":"预处理和两条编码支路到底做了什么？"},{"latex":"s_{ij}=v_i^\\top t_j","definitionContext":"预处理和两条编码支路到底做了什么？"},{"latex":"p(j|i,\\mathcal C)=\\exp(\\alpha s_{ij})/\\sum_{k\\in\\mathcal C}\\exp(\\alpha s_{ik})","definitionContext":"预处理和两条编码支路到底做了什么？"},{"latex":"\\alpha","definitionContext":"预处理和两条编码支路到底做了什么？"}],"previousBlock":"b-a009ac66ccd160075a3ca3ea","nextBlock":"b-b8d587d101a885711626d9a7","prerequisites":[{"id":"b-719e26a4931ee20702889e9e","url":"#b-719e26a4931ee20702889e9e","role":"section-title"},{"id":"b-a009ac66ccd160075a3ca3ea","url":"#b-a009ac66ccd160075a3ca3ea","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-b8d587d101a885711626d9a7","type":"p","scope":"block-e8d09daa81304bbebf6af1b6be1d73f0","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-b8d587d101a885711626d9a7","content":"候选 softmax 既没有估计候选之外的类别，也没有做概率校准。D 的 tiger 为 0.7174，只说明它在删去 cat 后的四个选项里分数最高；不能推出照片有 71.74% 的概率是一只老虎。图搜文是固定图片对多条文字排序，文搜图是固定文字对多张图片排序；两个方向使用同一相似度矩阵的不同维度，都不生成一个新句子。caption 需要逐词条件分布和解码器，详见 LAB 13。","sha256":"99beb2d6a5d9904ce69adb41cd2bf80d59594073ae2fbc7002054d338eb7ed7a","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-e8d09daa81304bbebf6af1b6be1d73f0","title":"预处理和两条编码支路到底做了什么？","number":9},"sectionTitle":"预处理和两条编码支路到底做了什么？","currentQuestion":"预处理和两条编码支路到底做了什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-fd359739b0bf453286709c4f","nextBlock":"b-29c638a5c2a90165a0a30fc9","prerequisites":[{"id":"b-719e26a4931ee20702889e9e","url":"#b-719e26a4931ee20702889e9e","role":"section-title"},{"id":"b-a009ac66ccd160075a3ca3ea","url":"#b-a009ac66ccd160075a3ca3ea","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-29c638a5c2a90165a0a30fc9","type":"pre","scope":"block-64ada4187bce4109b4173d43c262ff0c","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-29c638a5c2a90165a0a30fc9","content":"```\n# 可读的核心路径。默认不再重算；缓存已经由完全相同路径生成。\n# 将 RUN_FRESH_CLIP 改为 True 前，按说明准备依赖和固定权重。\nRUN_FRESH_CLIP=False\nif RUN_FRESH_CLIP:\n    import subprocess\n    subprocess.run([sys.executable,str(RETRIEVAL_ROOT/'fetch_clip.py')],check=True)\n    subprocess.run([sys.executable,str(RETRIEVAL_ROOT/'run_clip_retrieval.py'),'--encode'],check=True)\nelse:\n    saved=json.loads((RETRIEVAL_ROOT/'cache/clip-results.json').read_text())\n    for arm,r in saved['arms'].items():\n        print(arm,list(zip(r['candidate_names'],np.round(r['cosine'],4),np.round(r['softmax'],4))))\n    print('保存结果的来源:',p['execution'],p['generated_at_utc'])\n\n```","sha256":"dcb8e8d813addd004512eb521afca8b20bd31d80bae379d10f6f8cbaf5ab78ea","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-e8d09daa81304bbebf6af1b6be1d73f0","title":"预处理和两条编码支路到底做了什么？","number":9},"sectionTitle":"预处理和两条编码支路到底做了什么？","currentQuestion":"预处理和两条编码支路到底做了什么？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-b8d587d101a885711626d9a7","nextBlock":null,"prerequisites":[{"id":"b-719e26a4931ee20702889e9e","url":"#b-719e26a4931ee20702889e9e","role":"section-title"},{"id":"b-a009ac66ccd160075a3ca3ea","url":"#b-a009ac66ccd160075a3ca3ea","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-df02b822cc36277b51b7ba57","type":"h3","scope":"block-fe69124edb824641b98df3d509006d26","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-df02b822cc36277b51b7ba57","content":"### 同一对象只交换左右，真实 CLIP 是否跟着关系改变？","sha256":"7ac059a5d6acbb7df7d7247594440f929f11e269e6fcf963e5ba04897da6d384","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-fe69124edb824641b98df3d509006d26","title":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","number":10},"sectionTitle":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","currentQuestion":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-bd184b61e65ff0a23c1eed30","prerequisites":[{"id":"b-bd184b61e65ff0a23c1eed30","url":"#b-bd184b61e65ff0a23c1eed30","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-bd184b61e65ff0a23c1eed30","type":"p","scope":"block-fe69124edb824641b98df3d509006d26","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-bd184b61e65ff0a23c1eed30","content":"2026-09-22 的关系实验先把同一猫照片和同一宇航员照片各裁成 224×224 方块，放入固定的 448×448 灰色画布。第二张只交换两个方块的横向位置，灰背景、像素内容、尺寸和两条文字都固定。它是明确的照片拼贴教学构造，来源分别是 Stefan van der Walt 的 CC0 猫图与 NASA 公共领域照片，不声称是自然拍摄场景。","sha256":"8c84bc02bf8463b8af196d9274f7ef282ba65908660b7d37377d26b2089fb89a","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-fe69124edb824641b98df3d509006d26","title":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","number":10},"sectionTitle":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","currentQuestion":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-df02b822cc36277b51b7ba57","nextBlock":"b-350df4695d8f9ab7af33f884","prerequisites":[{"id":"b-df02b822cc36277b51b7ba57","url":"#b-df02b822cc36277b51b7ba57","role":"section-title"}],"relatedBlocks":[]},{"id":"b-350df4695d8f9ab7af33f884","type":"p","scope":"block-fe69124edb824641b98df3d509006d26","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-350df4695d8f9ab7af33f884","content":"候选 0：`a cat on the left and an astronaut on the right.`","sha256":"f735c764f3c62589e182b044ce6865be0ca8f039759bf7f5c7c9fd78ff665bc8","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-fe69124edb824641b98df3d509006d26","title":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","number":10},"sectionTitle":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","currentQuestion":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-bd184b61e65ff0a23c1eed30","nextBlock":"b-387c0554a5d938b77b18f3c4","prerequisites":[{"id":"b-df02b822cc36277b51b7ba57","url":"#b-df02b822cc36277b51b7ba57","role":"section-title"},{"id":"b-bd184b61e65ff0a23c1eed30","url":"#b-bd184b61e65ff0a23c1eed30","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-387c0554a5d938b77b18f3c4","type":"p","scope":"block-fe69124edb824641b98df3d509006d26","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-387c0554a5d938b77b18f3c4","content":"候选 1：`an astronaut on the left and a cat on the right.`","sha256":"79dc7892efcc1da8af7ad16e65b10381d1673c6f5bc050b7caa39a0bbc70700d","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-fe69124edb824641b98df3d509006d26","title":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","number":10},"sectionTitle":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","currentQuestion":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-350df4695d8f9ab7af33f884","nextBlock":"b-dafcf0048068c552262f8bd1","prerequisites":[{"id":"b-df02b822cc36277b51b7ba57","url":"#b-df02b822cc36277b51b7ba57","role":"section-title"},{"id":"b-bd184b61e65ff0a23c1eed30","url":"#b-bd184b61e65ff0a23c1eed30","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-dafcf0048068c552262f8bd1","type":"table","scope":"block-fe69124edb824641b98df3d509006d26","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-dafcf0048068c552262f8bd1","content":"| 实际输入 | 候选 0 cosine | 候选 1 cosine | 预测 | 判断 |\n| --- | --- | --- | --- | --- |\n| 猫左／宇航员右 | 0.378499 | 0.381837 | 1 | 错 |\n| 宇航员左／猫右 | 0.356597 | 0.363012 | 1 | 对 |","sha256":"3ec1e3ee3dbf7396948acd78933c373ecee23c156c809b4404de4b8571ad2360","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-fe69124edb824641b98df3d509006d26","title":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","number":10},"sectionTitle":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","currentQuestion":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"table":{"headers":["实际输入","候选 0 cosine","候选 1 cosine","预测","判断"],"rows":[["实际输入","候选 0 cosine","候选 1 cosine","预测","判断"],["猫左／宇航员右","0.378499","0.381837","1","错"],["宇航员左／猫右","0.356597","0.363012","1","对"]]},"previousBlock":"b-387c0554a5d938b77b18f3c4","nextBlock":"b-0b2bb034bc76a41ae63d5870","prerequisites":[{"id":"b-df02b822cc36277b51b7ba57","url":"#b-df02b822cc36277b51b7ba57","role":"section-title"},{"id":"b-bd184b61e65ff0a23c1eed30","url":"#b-bd184b61e65ff0a23c1eed30","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-0b2bb034bc76a41ae63d5870","type":"p","scope":"block-fe69124edb824641b98df3d509006d26","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-0b2bb034bc76a41ae63d5870","content":"![相同照片方块的左右交换及真实CLIP分数](/assets/display/63d21d5ec6a87d5ee56b04b2.webp)","sha256":"1d0b2a7ce1bb72f95f0d4304d050899a306979d1b03fa92d2fc803a647ac7336","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-fe69124edb824641b98df3d509006d26","title":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","number":10},"sectionTitle":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","currentQuestion":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-dafcf0048068c552262f8bd1","nextBlock":"b-476f4c9f97923e1b4177d3e0","prerequisites":[{"id":"b-df02b822cc36277b51b7ba57","url":"#b-df02b822cc36277b51b7ba57","role":"section-title"},{"id":"b-bd184b61e65ff0a23c1eed30","url":"#b-bd184b61e65ff0a23c1eed30","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-476f4c9f97923e1b4177d3e0","type":"p","scope":"block-fe69124edb824641b98df3d509006d26","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-476f4c9f97923e1b4177d3e0","content":"分数本身确实随图改变，但两次排序都偏好候选 1。模型能抓住对象共现，不保证正确绑定“谁在左边”。这不是只看生成的句子判断成败，而是用已知坐标定义真值，再检验排序。两例能构成一个明确反例，不能估计关系理解的总体水平。","sha256":"806fe8c86c3c9aadc4ffa157cb8edc8f2fc602542886779fdcb0e4d58fb0508e","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-fe69124edb824641b98df3d509006d26","title":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","number":10},"sectionTitle":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","currentQuestion":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-0b2bb034bc76a41ae63d5870","nextBlock":"b-ec3ee30166356e98ee5a72c9","prerequisites":[{"id":"b-df02b822cc36277b51b7ba57","url":"#b-df02b822cc36277b51b7ba57","role":"section-title"},{"id":"b-bd184b61e65ff0a23c1eed30","url":"#b-bd184b61e65ff0a23c1eed30","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-ec3ee30166356e98ee5a72c9","type":"p","scope":"block-fe69124edb824641b98df3d509006d26","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-ec3ee30166356e98ee5a72c9","content":"原四幅持球图也在 2026-09-22 实际编码，分数如下；前文“关系规则”的表仍是规则输出，不能用这个新表倒改其身份。四幅旧插图存在背景和姿态差异，所以 3/4 的局部正确率不是严格单变量因果结论。","sha256":"3497e96d58dc2972c4778f16299cd0d10bf3f4ec96e17723732b6a11da03e818","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-fe69124edb824641b98df3d509006d26","title":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","number":10},"sectionTitle":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","currentQuestion":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-476f4c9f97923e1b4177d3e0","nextBlock":"b-5f3418709fc786fd32f51fc8","prerequisites":[{"id":"b-df02b822cc36277b51b7ba57","url":"#b-df02b822cc36277b51b7ba57","role":"section-title"},{"id":"b-bd184b61e65ff0a23c1eed30","url":"#b-bd184b61e65ff0a23c1eed30","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-5f3418709fc786fd32f51fc8","type":"table","scope":"block-fe69124edb824641b98df3d509006d26","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-5f3418709fc786fd32f51fc8","content":"| 条件 | 红衣持球文句 A | 蓝衣持球文句 B | CLIP 选择 | 定义真值 |\n| --- | --- | --- | --- | --- |\n| 1 | 0.292193 | 0.292328 | B | A |\n| 2 | 0.292411 | 0.292754 | B | B |\n| 3 | 0.316829 | 0.317146 | B | B |\n| 4 | 0.308224 | 0.307590 | A | A |","sha256":"ec5d460f4c48ecc687ff0935f8137756cf6a1467da9a7b1f45a6dc17dec31e0f","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-fe69124edb824641b98df3d509006d26","title":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","number":10},"sectionTitle":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","currentQuestion":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"table":{"headers":["条件","红衣持球文句 A","蓝衣持球文句 B","CLIP 选择","定义真值"],"rows":[["条件","红衣持球文句 A","蓝衣持球文句 B","CLIP 选择","定义真值"],["1","0.292193","0.292328","B","A"],["2","0.292411","0.292754","B","B"],["3","0.316829","0.317146","B","B"],["4","0.308224","0.307590","A","A"]]},"previousBlock":"b-ec3ee30166356e98ee5a72c9","nextBlock":"b-299ae4e8a459c9a2eb4bc5ef","prerequisites":[{"id":"b-df02b822cc36277b51b7ba57","url":"#b-df02b822cc36277b51b7ba57","role":"section-title"},{"id":"b-bd184b61e65ff0a23c1eed30","url":"#b-bd184b61e65ff0a23c1eed30","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-299ae4e8a459c9a2eb4bc5ef","type":"p","scope":"block-fe69124edb824641b98df3d509006d26","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-299ae4e8a459c9a2eb4bc5ef","content":"这里所有差距都很小。只看一张正确图片或只看最高候选名会掩盖这一点；扩充数据前不要把这四个结果称为稳定的关系能力。","sha256":"b55b067d7e48b31ea372b22834be62e1e36721acdc3a5bfc7ffd04306b7901b8","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-fe69124edb824641b98df3d509006d26","title":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","number":10},"sectionTitle":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","currentQuestion":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-5f3418709fc786fd32f51fc8","nextBlock":"b-8d295b97a3b861e92a0839f9","prerequisites":[{"id":"b-df02b822cc36277b51b7ba57","url":"#b-df02b822cc36277b51b7ba57","role":"section-title"},{"id":"b-bd184b61e65ff0a23c1eed30","url":"#b-bd184b61e65ff0a23c1eed30","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-8d295b97a3b861e92a0839f9","type":"p","scope":"block-fe69124edb824641b98df3d509006d26","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-8d295b97a3b861e92a0839f9","content":"**与当前课堂四格的区别：**上表属于已保存的旧四幅输入。v18 的 P61–62 后来改用同源颜色编辑和确定性镜像，不能直接把此处旧分数当作当前四格的模型输出。当前网页四格用于两条规则的预测比较；模型证据请依据本节保存的图片与输入哈希。[当前四格的具体变化](/course/blocks/relation-four-condition-table.html)。","sha256":"1799601886b89f3c1ac7d43d891faf83d72a0cc4fe12e93c59c4a087d6dfc201","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-fe69124edb824641b98df3d509006d26","title":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","number":10},"sectionTitle":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","currentQuestion":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-299ae4e8a459c9a2eb4bc5ef","nextBlock":"b-8ac77609e3ec9a04e177b7be","prerequisites":[{"id":"b-df02b822cc36277b51b7ba57","url":"#b-df02b822cc36277b51b7ba57","role":"section-title"},{"id":"b-bd184b61e65ff0a23c1eed30","url":"#b-bd184b61e65ff0a23c1eed30","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-8ac77609e3ec9a04e177b7be","type":"pre","scope":"block-880250bb392141d3b60ed38535b8d073","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-8ac77609e3ec9a04e177b7be","content":"```\n# 重做缓存后的关系排序；可改排序/显示，不能改真值去迎合模型。\ncos=a['relation_images']@a['relation_text'].T\nprint('关系 cosine:',cos)\nprint('预测:',cos.argmax(1),'真值:',[0,1])\nassert cos.argmax(1).tolist()==[1,1]  # 当前已核验缓存的实际反例\nfor r in manifest['relation']:\n    from IPython.display import display\n    from PIL import Image\n    display(Image.open(RETRIEVAL_ROOT/r['path']))\n\n```","sha256":"2ec5369fc96bcf8962f7df785a96a1a27dcfbec593a55fc99ff5752411bcdcec","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-fe69124edb824641b98df3d509006d26","title":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","number":10},"sectionTitle":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","currentQuestion":"同一对象只交换左右，真实 CLIP 是否跟着关系改变？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-8d295b97a3b861e92a0839f9","nextBlock":null,"prerequisites":[{"id":"b-df02b822cc36277b51b7ba57","url":"#b-df02b822cc36277b51b7ba57","role":"section-title"},{"id":"b-bd184b61e65ff0a23c1eed30","url":"#b-bd184b61e65ff0a23c1eed30","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-650c2f55f0ed74cc4d226651","type":"h3","scope":"block-1cff4428a5f343258064d92cb3ab303d","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-650c2f55f0ed74cc4d226651","content":"### 下一步：同一批真实向量怎样变成检索系统？","sha256":"4c310beb24f67f7b41d22417d3d41805a995c0073d194cf3740c10a130a405a3","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-1cff4428a5f343258064d92cb3ab303d","title":"下一步：同一批真实向量怎样变成检索系统？","number":11},"sectionTitle":"下一步：同一批真实向量怎样变成检索系统？","currentQuestion":"下一步：同一批真实向量怎样变成检索系统？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-8021b889ddc4074a254b5f84","prerequisites":[{"id":"b-8021b889ddc4074a254b5f84","url":"#b-8021b889ddc4074a254b5f84","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-8021b889ddc4074a254b5f84","type":"p","scope":"block-1cff4428a5f343258064d92cb3ab303d","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-8021b889ddc4074a254b5f84","content":"[LAB 12 · CLIP延伸：缓存与检索（近似索引选读）](https://deepnote.com/workspace/ise3309jingao-5ba66b0a-4283-4f5a-ae06-3f68d3201e99/project/38755e4e-23f6-4f5f-8c68-8a2e4114b1c1/notebook/921eeaf784284ce19568c6ca7619b55a?utm_source=openai&utm_medium=mcp&utm_campaign=openaimcp&utm_content=921eeaf784284ce19568c6ca7619b55a&utm_term=get_notebook) 使用本包的 24×512 图片缓存与 12×512 查询缓存。那一册把“模型有分数”继续拆成三个问题：相关样本是否排在前面，近似索引漏掉了哪些 exact 邻居，以及减少向量运算是否真的减少了这个小系统的实测延迟。","sha256":"73c81d282dc0a009ff3e11bf4f9acae506b11b852ad99bbbf05f1b824bea5d66","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-1cff4428a5f343258064d92cb3ab303d","title":"下一步：同一批真实向量怎样变成检索系统？","number":11},"sectionTitle":"下一步：同一批真实向量怎样变成检索系统？","currentQuestion":"下一步：同一批真实向量怎样变成检索系统？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-650c2f55f0ed74cc4d226651","nextBlock":"b-d35cb4504f9610db053d0820","prerequisites":[{"id":"b-650c2f55f0ed74cc4d226651","url":"#b-650c2f55f0ed74cc4d226651","role":"section-title"}],"relatedBlocks":[]},{"id":"b-d35cb4504f9610db053d0820","type":"p","scope":"block-1cff4428a5f343258064d92cb3ab303d","url":"https://codingai-lec03.pages.dev/course/notebooks/0ba963931ddf4866b507b210d93a43bf.html#b-d35cb4504f9610db053d0820","content":"这里保存的 2026-09-22 运行地点是本地 Linux CPU，Python 3.12.14、Torch 2.14.0+cpu、Transformers 4.57.1；未将这次运行标成 Deepnote 云端执行。`legacy-audit.json`、`cache/provenance.json` 与 `verified/execution.json` 分别记录旧源核验、当时完成的真实编码与完整脚本身份。","sha256":"b04e147217a25fe3dc5695b3b5f963a1c7782d0c632515147ea7cf5f88231fb9","chapter":{"id":"III","title":"视觉与语言"},"unit":{"id":"clip-pairing-to-candidates","title":"已知图文配对怎样变成可用的文字候选接口？"},"page":{"id":"reading-block-1cff4428a5f343258064d92cb3ab303d","title":"下一步：同一批真实向量怎样变成检索系统？","number":11},"sectionTitle":"下一步：同一批真实向量怎样变成检索系统？","currentQuestion":"下一步：同一批真实向量怎样变成检索系统？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-8021b889ddc4074a254b5f84","nextBlock":null,"prerequisites":[{"id":"b-650c2f55f0ed74cc4d226651","url":"#b-650c2f55f0ed74cc4d226651","role":"section-title"},{"id":"b-8021b889ddc4074a254b5f84","url":"#b-8021b889ddc4074a254b5f84","role":"problem-context"}],"relatedBlocks":[]}]}
