{"version":2,"relationshipURLBase":"https://codingai-lec03.pages.dev/course/lab09-transfer.html","relationshipResolution":"Resolve relative relationship URLs against relationshipURLBase; complete records and absolute URLs are in blocks.","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html","markdown":"https://codingai-lec03.pages.dev/course/lab09-transfer.md","pages":[{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","unit":"LAB 02 · 参数迁移：冻结、局部与全量微调","unitId":"lab09-transfer","chapter":"course","number":1},{"id":"reading-block-ee8a87d747b242478019aba89d2e46d3","title":"准备：本实验的固定材料","unit":"LAB 02 · 参数迁移：冻结、局部与全量微调","unitId":"lab09-transfer","chapter":"course","number":2},{"id":"reading-block-58bc52fbf8f147819e934fbe8e30546a","title":"1. 先写预测，再确定协议","unit":"LAB 02 · 参数迁移：冻结、局部与全量微调","unitId":"lab09-transfer","chapter":"course","number":3},{"id":"reading-block-1c379ad583d74af7839f0841395946a8","title":"2. “冻住”到底冻住哪些参数？","unit":"LAB 02 · 参数迁移：冻结、局部与全量微调","unitId":"lab09-transfer","chapter":"course","number":4},{"id":"reading-block-0495306a95d840a5837582faa71e8a04","title":"3. 运行比较：用验证集选每组的停点","unit":"LAB 02 · 参数迁移：冻结、局部与全量微调","unitId":"lab09-transfer","chapter":"course","number":5},{"id":"reading-block-7b9a96ec2b424da28938ca221b03097d","title":"4. 固定选择后，再看保留集","unit":"LAB 02 · 参数迁移：冻结、局部与全量微调","unitId":"lab09-transfer","chapter":"course","number":6},{"id":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","title":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","unit":"LAB 02 · 参数迁移：冻结、局部与全量微调","unitId":"lab09-transfer","chapter":"course","number":7},{"id":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","title":"6 · 选读：参数、梯度记录和模块状态","unit":"LAB 02 · 参数迁移：冻结、局部与全量微调","unitId":"lab09-transfer","chapter":"course","number":8}],"aliases":[{"oldId":"b-6b65e05695e554af6d0209e5","targetId":"b-6b65e05695e554af6d0209e5","page":"reading-opening","operation":"move","beforeSHA256":"8339f90807c2cbbd91da21ef315a124b87950f2f9373d30fbbdf45c39e9a74c0","afterSHA256":"8339f90807c2cbbd91da21ef315a124b87950f2f9373d30fbbdf45c39e9a74c0","reason":"Same source body in authored semantic page"},{"oldId":"b-911802c7fc6227790199c9f8","targetId":"b-911802c7fc6227790199c9f8","page":"reading-opening","operation":"move","beforeSHA256":"e91f24e4e4ca40e2099a0d81d30db6568f4bf2074b499eeee6e3959617bd97ac","afterSHA256":"e91f24e4e4ca40e2099a0d81d30db6568f4bf2074b499eeee6e3959617bd97ac","reason":"Same source body in authored semantic page"},{"oldId":"b-eb32dc41c0593ca3db31117f","targetId":"b-eb32dc41c0593ca3db31117f","page":"reading-opening","operation":"move","beforeSHA256":"5f1e2e7a35a6afaca427b0b03cfec448b4aac4324b16108f14671986a2d98b38","afterSHA256":"5f1e2e7a35a6afaca427b0b03cfec448b4aac4324b16108f14671986a2d98b38","reason":"Same source body in authored semantic page"},{"oldId":"b-76e3a6cf3cd0684c4413b1ee","targetId":"b-76e3a6cf3cd0684c4413b1ee","page":"reading-opening","operation":"move","beforeSHA256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","afterSHA256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","reason":"Same source body in authored semantic page"},{"oldId":"b-471329e7af841d8d69fc0662","targetId":"b-471329e7af841d8d69fc0662","page":"reading-opening","operation":"move","beforeSHA256":"efc07be0d238c97b2a0f2a3e1e141f27691e7d1aadb5b0bc2662d7d40218327f","afterSHA256":"efc07be0d238c97b2a0f2a3e1e141f27691e7d1aadb5b0bc2662d7d40218327f","reason":"Same source body in authored semantic page"},{"oldId":"b-5a459cd95c8c2f5fffd0f55e","targetId":"b-5a459cd95c8c2f5fffd0f55e","page":"reading-opening","operation":"move","beforeSHA256":"1ce2327a72de3b56c61487d99fcf335697039073a22eabe9e80a832af0210b94","afterSHA256":"1ce2327a72de3b56c61487d99fcf335697039073a22eabe9e80a832af0210b94","reason":"Same source body in authored semantic page"},{"oldId":"b-8f6eebb6181e7b8146e16987","targetId":"b-8f6eebb6181e7b8146e16987","page":"reading-opening","operation":"move","beforeSHA256":"4c7762221f1bc0b89815a6ad7702b267278cd03cd6cfc6923f649d8cf97ca501","afterSHA256":"4c7762221f1bc0b89815a6ad7702b267278cd03cd6cfc6923f649d8cf97ca501","reason":"Same source body in authored semantic page"},{"oldId":"b-e35385ff6c4dbc4aaed0c13a","targetId":"b-e35385ff6c4dbc4aaed0c13a","page":"reading-opening","operation":"move","beforeSHA256":"6133de7dfaf36f19f786d9511c3ec0671a95209420e4ec93f9cd36ac8bc587a7","afterSHA256":"6133de7dfaf36f19f786d9511c3ec0671a95209420e4ec93f9cd36ac8bc587a7","reason":"Same source body in authored semantic page"},{"oldId":"b-b3df06406beb59755eda207c","targetId":"b-b3df06406beb59755eda207c","page":"reading-opening","operation":"move","beforeSHA256":"0c6bcd22b6e25f16c071abc776e71f1a7d4c003d0cfac515b5552bcc902db63c","afterSHA256":"0c6bcd22b6e25f16c071abc776e71f1a7d4c003d0cfac515b5552bcc902db63c","reason":"Same source body in authored semantic page"},{"oldId":"b-432affd591d4f5d4cec3e07b","targetId":"b-432affd591d4f5d4cec3e07b","page":"reading-opening","operation":"move","beforeSHA256":"a57afd051b75313373fc15acb807f4e5e18dc1164690bd33623d9d5e5a01cd39","afterSHA256":"a57afd051b75313373fc15acb807f4e5e18dc1164690bd33623d9d5e5a01cd39","reason":"Same source body in authored semantic page"},{"oldId":"b-b0039765f4898eb701efa6ba","targetId":"b-b0039765f4898eb701efa6ba","page":"reading-opening","operation":"move","beforeSHA256":"846c98446c2fa9745117fb7e7656e32d8c465a172d25edbc2cff11503ff8a41b","afterSHA256":"846c98446c2fa9745117fb7e7656e32d8c465a172d25edbc2cff11503ff8a41b","reason":"Same source body in authored semantic page"},{"oldId":"b-13e4a4e455829811b8c182f2","targetId":"b-13e4a4e455829811b8c182f2","page":"reading-opening","operation":"move","beforeSHA256":"716a6c8b03f04c28aaa995e5bf0607242e9a44a9d05439a39cc1148b52e02416","afterSHA256":"297a6a89ce67eac19a4987a19e76cdf9239a0e87a037a553fbd125b1f946b035","reason":"Same source body in authored semantic page"},{"oldId":"b-6c963d4b89f9d68116ae8d60","targetId":"b-6c963d4b89f9d68116ae8d60","page":"reading-opening","operation":"move","beforeSHA256":"4514df1fa225ba31be50281a7673f6cf07f17391889f25df198e0968e331f3fe","afterSHA256":"4514df1fa225ba31be50281a7673f6cf07f17391889f25df198e0968e331f3fe","reason":"Same source body in authored semantic page"},{"oldId":"b-890bca68358d4c8464e163d1","targetId":"b-890bca68358d4c8464e163d1","page":"reading-opening","operation":"move","beforeSHA256":"4cb8dfb4b49ec0c9d9515b9fe867a03b415ee588ae198b4df85a646b0a16ae33","afterSHA256":"4cb8dfb4b49ec0c9d9515b9fe867a03b415ee588ae198b4df85a646b0a16ae33","reason":"Same source body in authored semantic page"},{"oldId":"b-48a88fb080874f6d82ee1051","targetId":"b-48a88fb080874f6d82ee1051","page":"reading-opening","operation":"move","beforeSHA256":"4d912dfa8a0b740bc65ae32f6bc894e5f483da61da3821e43d66daacfea2c667","afterSHA256":"4d912dfa8a0b740bc65ae32f6bc894e5f483da61da3821e43d66daacfea2c667","reason":"Same source body in authored semantic page"},{"oldId":"b-ddcfec1d821272bb314ecd51","targetId":"b-ddcfec1d821272bb314ecd51","page":"reading-opening","operation":"move","beforeSHA256":"821891af1b69990a1122e6e8d5a062992dedfbb4e58c62b7eaa4ec9ba8bc2005","afterSHA256":"821891af1b69990a1122e6e8d5a062992dedfbb4e58c62b7eaa4ec9ba8bc2005","reason":"Same source body in authored semantic page"},{"oldId":"b-95b15cd7f7df38aa108e0cce","targetId":"b-95b15cd7f7df38aa108e0cce","page":"reading-opening","operation":"move","beforeSHA256":"a386e1d2973766b77657afcace445a7585e4d46a25b3d3e1aaaf454c261c411f","afterSHA256":"a386e1d2973766b77657afcace445a7585e4d46a25b3d3e1aaaf454c261c411f","reason":"Same source body in authored semantic page"},{"oldId":"b-e2a13dbc2bd49ef7fd293729","targetId":"b-e2a13dbc2bd49ef7fd293729","page":"reading-block-ee8a87d747b242478019aba89d2e46d3","operation":"move","beforeSHA256":"58943d8a10b53cc66740a7eaa1e71f8fa71ae3c3ad01f2fe55418251a3986e98","afterSHA256":"58943d8a10b53cc66740a7eaa1e71f8fa71ae3c3ad01f2fe55418251a3986e98","reason":"Same source body in authored semantic page"},{"oldId":"b-5a6ac756a61b19ffc7d3553f","targetId":"b-5a6ac756a61b19ffc7d3553f","page":"reading-block-ee8a87d747b242478019aba89d2e46d3","operation":"move","beforeSHA256":"629b478c7fe01588b8416b1bd41f4491c95e201282d93a0f5eb2bc35817a410b","afterSHA256":"629b478c7fe01588b8416b1bd41f4491c95e201282d93a0f5eb2bc35817a410b","reason":"Same source body in authored semantic page"},{"oldId":"b-568245e693190f2e5570743b","targetId":"b-568245e693190f2e5570743b","page":"reading-block-ee8a87d747b242478019aba89d2e46d3","operation":"move","beforeSHA256":"db71370d749b53729b1253732f65ddc5df6211d8d4deb575f8fff2eea4030213","afterSHA256":"db71370d749b53729b1253732f65ddc5df6211d8d4deb575f8fff2eea4030213","reason":"Same source body in authored semantic page"},{"oldId":"b-02cc02f00d19b77d092ea42a","targetId":"b-02cc02f00d19b77d092ea42a","page":"reading-block-ee8a87d747b242478019aba89d2e46d3","operation":"move","beforeSHA256":"55255cb059dec3efe2a47cad7fea9054dce0ec22249f51f1c8cbdd2500cdc5f1","afterSHA256":"55255cb059dec3efe2a47cad7fea9054dce0ec22249f51f1c8cbdd2500cdc5f1","reason":"Same source body in authored semantic page"},{"oldId":"b-5239c695c9e432a06604e380","targetId":"b-5239c695c9e432a06604e380","page":"reading-block-ee8a87d747b242478019aba89d2e46d3","operation":"move","beforeSHA256":"9e914efedd4eae705e14123b928f44c3ddc6b8152586aa5cba003c756c27e34c","afterSHA256":"9e914efedd4eae705e14123b928f44c3ddc6b8152586aa5cba003c756c27e34c","reason":"Same source body in authored semantic page"},{"oldId":"b-42bba9f3bddc161502748d69","targetId":"b-42bba9f3bddc161502748d69","page":"reading-block-ee8a87d747b242478019aba89d2e46d3","operation":"move","beforeSHA256":"440c32dbdc4c8107b5661bdcd8fa46ca99346205535609ee17e2e6f2a31f31b6","afterSHA256":"440c32dbdc4c8107b5661bdcd8fa46ca99346205535609ee17e2e6f2a31f31b6","reason":"Same source body in authored semantic page"},{"oldId":"b-c18b482697a99463e0f2cb35","targetId":"b-c18b482697a99463e0f2cb35","page":"reading-block-ee8a87d747b242478019aba89d2e46d3","operation":"move","beforeSHA256":"07984659f22edf1a9718250b393647b37fc539bd8865faf43ca5beac4b98fb65","afterSHA256":"07984659f22edf1a9718250b393647b37fc539bd8865faf43ca5beac4b98fb65","reason":"Same source body in authored semantic page"},{"oldId":"b-d6083ce19ddf68167749f765","targetId":"b-d6083ce19ddf68167749f765","page":"reading-block-ee8a87d747b242478019aba89d2e46d3","operation":"move","beforeSHA256":"4e8403f272270dbf8b62b8561945ef255842c8d5a118f15592e3f54af0326e72","afterSHA256":"4e8403f272270dbf8b62b8561945ef255842c8d5a118f15592e3f54af0326e72","reason":"Same source body in authored semantic page"},{"oldId":"b-fda7e8d5359270f23d5ba515","targetId":"b-fda7e8d5359270f23d5ba515","page":"reading-block-58bc52fbf8f147819e934fbe8e30546a","operation":"move","beforeSHA256":"fff10c83fb1c7731acdea30738ea12d6c7665a102976f655e1815e0c6a6b05fd","afterSHA256":"fff10c83fb1c7731acdea30738ea12d6c7665a102976f655e1815e0c6a6b05fd","reason":"Same source body in authored semantic page"},{"oldId":"b-53b4b4d8a423e2cf8bc8fa76","targetId":"b-53b4b4d8a423e2cf8bc8fa76","page":"reading-block-58bc52fbf8f147819e934fbe8e30546a","operation":"move","beforeSHA256":"6320b48d910d74528b03f0c49a483751c114c81600f6bed611660eb2b3999c61","afterSHA256":"6320b48d910d74528b03f0c49a483751c114c81600f6bed611660eb2b3999c61","reason":"Same source body in authored semantic page"},{"oldId":"b-c5736377f6cdb7018ac4f0dd","targetId":"b-c5736377f6cdb7018ac4f0dd","page":"reading-block-58bc52fbf8f147819e934fbe8e30546a","operation":"move","beforeSHA256":"ea802943c39d3d32dfdc7dc4d741bd9099f866782a856c5a84840c630d99b853","afterSHA256":"1a6f72d0996ad9890c56d6281429fdd5a78b53d097529d9c51bc27befd66c40a","reason":"Same source body in authored semantic page"},{"oldId":"b-3e25f7d3d45af340f232b0c2","targetId":"b-3e25f7d3d45af340f232b0c2","page":"reading-block-58bc52fbf8f147819e934fbe8e30546a","operation":"move","beforeSHA256":"1cb3a431652e3f862ec1768e31c00f6c361b2759fc0c3a1765f8608490118fef","afterSHA256":"1cb3a431652e3f862ec1768e31c00f6c361b2759fc0c3a1765f8608490118fef","reason":"Same source body in authored semantic page"},{"oldId":"b-b5ef3825402fada05b16e817","targetId":"b-b5ef3825402fada05b16e817","page":"reading-block-58bc52fbf8f147819e934fbe8e30546a","operation":"move","beforeSHA256":"77dbd1f9649c64d06ce84e4e168648f2822474f98473b06b0c88310331d3e6a0","afterSHA256":"77dbd1f9649c64d06ce84e4e168648f2822474f98473b06b0c88310331d3e6a0","reason":"Same source body in authored semantic page"},{"oldId":"b-1d81dc30e4c2e9598107beca","targetId":"b-1d81dc30e4c2e9598107beca","page":"reading-block-58bc52fbf8f147819e934fbe8e30546a","operation":"move","beforeSHA256":"4fd422fc9b896a8f7f426ed1d1d0fa03231376c7acf1f17de28d1fe58410c68a","afterSHA256":"4fd422fc9b896a8f7f426ed1d1d0fa03231376c7acf1f17de28d1fe58410c68a","reason":"Same source body in authored semantic page"},{"oldId":"b-a508c68451fcf22faca6d7b9","targetId":"b-a508c68451fcf22faca6d7b9","page":"reading-block-58bc52fbf8f147819e934fbe8e30546a","operation":"move","beforeSHA256":"02d74538e6f7284ba314ae174996ba31ae91ac9421566e640487993906ec5454","afterSHA256":"02d74538e6f7284ba314ae174996ba31ae91ac9421566e640487993906ec5454","reason":"Same source body in authored semantic page"},{"oldId":"b-96cf66715d55641293108248","targetId":"b-96cf66715d55641293108248","page":"reading-block-1c379ad583d74af7839f0841395946a8","operation":"move","beforeSHA256":"f151546c7a62df6bf209e28a32ba66ee3bc3f9a04df7f0d2e89a0406d325eca3","afterSHA256":"f151546c7a62df6bf209e28a32ba66ee3bc3f9a04df7f0d2e89a0406d325eca3","reason":"Same source body in authored semantic page"},{"oldId":"b-67c35981c49694dc55ed922f","targetId":"b-67c35981c49694dc55ed922f","page":"reading-block-1c379ad583d74af7839f0841395946a8","operation":"move","beforeSHA256":"86bf1e8c8d22a77cd5d030bd8e0042fa511b44104c1da9b3f27c013812b3a926","afterSHA256":"86bf1e8c8d22a77cd5d030bd8e0042fa511b44104c1da9b3f27c013812b3a926","reason":"Same source body in authored semantic page"},{"oldId":"b-26976e14dd68ee119d3e1f57","targetId":"b-26976e14dd68ee119d3e1f57","page":"reading-block-1c379ad583d74af7839f0841395946a8","operation":"move","beforeSHA256":"690bd30a4098c4cd35db7e88ceb8bba117666d124dc601d323ee259c60dac739","afterSHA256":"ec4c606e694c6dc973809f260ea5c77d113bc6ccd357c194b779fd59c57e4cd4","reason":"Same source body in authored semantic page"},{"oldId":"b-bfc43c493868b16acadcf374","targetId":"b-bfc43c493868b16acadcf374","page":"reading-block-1c379ad583d74af7839f0841395946a8","operation":"move","beforeSHA256":"dead0c8a985006720ce61c896bf6d02cd0fbebf95c7939814f83ada6c43bf3cf","afterSHA256":"dead0c8a985006720ce61c896bf6d02cd0fbebf95c7939814f83ada6c43bf3cf","reason":"Same source body in authored semantic page"},{"oldId":"b-1c6ea9c382704cdf0c1fc142","targetId":"b-1c6ea9c382704cdf0c1fc142","page":"reading-block-1c379ad583d74af7839f0841395946a8","operation":"move","beforeSHA256":"e580addcfdfa6a676db4a687760666e181c144aa6b64eecc14c054741a4907cd","afterSHA256":"e580addcfdfa6a676db4a687760666e181c144aa6b64eecc14c054741a4907cd","reason":"Same source body in authored semantic page"},{"oldId":"b-1d802c5157c989ab10c58007","targetId":"b-1d802c5157c989ab10c58007","page":"reading-block-1c379ad583d74af7839f0841395946a8","operation":"move","beforeSHA256":"67184c6695a342ff12be15f55b2cad092ca136d235bb452372876edea329e49b","afterSHA256":"67184c6695a342ff12be15f55b2cad092ca136d235bb452372876edea329e49b","reason":"Same source body in authored semantic page"},{"oldId":"b-d4077e76b03ee044cd49235b","targetId":"b-d4077e76b03ee044cd49235b","page":"reading-block-1c379ad583d74af7839f0841395946a8","operation":"move","beforeSHA256":"50df0b56441a59cc0172558e60fc91669887bef661ad949627c013ccd35dbf34","afterSHA256":"50df0b56441a59cc0172558e60fc91669887bef661ad949627c013ccd35dbf34","reason":"Same source body in authored semantic page"},{"oldId":"b-8fbe6142d48e42cb1941e67d","targetId":"b-8fbe6142d48e42cb1941e67d","page":"reading-block-0495306a95d840a5837582faa71e8a04","operation":"move","beforeSHA256":"e4e3c4d0cfa9f8dc4bd8eee648560a8ff2ff2c4d020188e1a0a421fa8986a00f","afterSHA256":"e4e3c4d0cfa9f8dc4bd8eee648560a8ff2ff2c4d020188e1a0a421fa8986a00f","reason":"Same source body in authored semantic page"},{"oldId":"b-86a20a34b5aac7ffdbf8de1a","targetId":"b-86a20a34b5aac7ffdbf8de1a","page":"reading-block-0495306a95d840a5837582faa71e8a04","operation":"move","beforeSHA256":"08dcf22268615760559a490d3f823d319cf0ae8c6fccbcf76fb5f6b09ff63fc8","afterSHA256":"08dcf22268615760559a490d3f823d319cf0ae8c6fccbcf76fb5f6b09ff63fc8","reason":"Same source body in authored semantic page"},{"oldId":"b-a9d1329cf78f5da5327bc9f8","targetId":"b-a9d1329cf78f5da5327bc9f8","page":"reading-block-0495306a95d840a5837582faa71e8a04","operation":"move","beforeSHA256":"1ce6ac13eb2177a895947eb161c088f1c0bb64a33decb2c8172075da304161c1","afterSHA256":"baf347de31235f91376833124bba944375185aab9f5623cf91cdc5e8a698fa04","reason":"Same source body in authored semantic page"},{"oldId":"b-ca04318e7e053ef604ea787c","targetId":"b-ca04318e7e053ef604ea787c","page":"reading-block-0495306a95d840a5837582faa71e8a04","operation":"move","beforeSHA256":"89f96008cc20d30f5de04d1703f446613d73a26bcc8a3adfa0ff4da6ee1b9c51","afterSHA256":"89f96008cc20d30f5de04d1703f446613d73a26bcc8a3adfa0ff4da6ee1b9c51","reason":"Same source body in authored semantic page"},{"oldId":"b-ad98c14db657ee76236d99c5","targetId":"b-ad98c14db657ee76236d99c5","page":"reading-block-0495306a95d840a5837582faa71e8a04","operation":"move","beforeSHA256":"6e3c1e31f12d9894e36b5aed3ec68c9805c05930350d22402c986f73c3d236bc","afterSHA256":"6e3c1e31f12d9894e36b5aed3ec68c9805c05930350d22402c986f73c3d236bc","reason":"Same source body in authored semantic page"},{"oldId":"b-ddd872e37f88d5ad6d3631a4","targetId":"b-ddd872e37f88d5ad6d3631a4","page":"reading-block-0495306a95d840a5837582faa71e8a04","operation":"move","beforeSHA256":"d69bbf3ce85d2d67714ac517b70f03313a350affa45dc8a434a1fc16464212d2","afterSHA256":"d69bbf3ce85d2d67714ac517b70f03313a350affa45dc8a434a1fc16464212d2","reason":"Same source body in authored semantic page"},{"oldId":"b-6c0bf197d193218dc6a53131","targetId":"b-6c0bf197d193218dc6a53131","page":"reading-block-0495306a95d840a5837582faa71e8a04","operation":"move","beforeSHA256":"0d895fee1d544d1219f5704ce4ce47b623f9d946f397f4864637896fee477584","afterSHA256":"0d895fee1d544d1219f5704ce4ce47b623f9d946f397f4864637896fee477584","reason":"Same source body in authored semantic page"},{"oldId":"b-2d20f4eaf76d8cd07ea0efa8","targetId":"b-2d20f4eaf76d8cd07ea0efa8","page":"reading-block-7b9a96ec2b424da28938ca221b03097d","operation":"move","beforeSHA256":"5d65a30157b1630350682f10e6b268263c0812c39ffb61fa8da0ac2cae978bad","afterSHA256":"5d65a30157b1630350682f10e6b268263c0812c39ffb61fa8da0ac2cae978bad","reason":"Same source body in authored semantic page"},{"oldId":"b-9da8b9711ba1f6dbc0725f5f","targetId":"b-9da8b9711ba1f6dbc0725f5f","page":"reading-block-7b9a96ec2b424da28938ca221b03097d","operation":"move","beforeSHA256":"ebcefced2fe65e545e3bf8745e0bdced48d541e7e6bc69123f5e7dd33add24c8","afterSHA256":"ebcefced2fe65e545e3bf8745e0bdced48d541e7e6bc69123f5e7dd33add24c8","reason":"Same source body in authored semantic page"},{"oldId":"b-3d3b197708ecb39487f6df16","targetId":"b-3d3b197708ecb39487f6df16","page":"reading-block-7b9a96ec2b424da28938ca221b03097d","operation":"move","beforeSHA256":"bb2f4695f75c88ba952908a06f229ea62ed5a5d6f281ea33a47b9daee3c76975","afterSHA256":"bb2f4695f75c88ba952908a06f229ea62ed5a5d6f281ea33a47b9daee3c76975","reason":"Same source body in authored semantic page"},{"oldId":"b-f4d92f67726b720fb2f2605a","targetId":"b-f4d92f67726b720fb2f2605a","page":"reading-block-7b9a96ec2b424da28938ca221b03097d","operation":"move","beforeSHA256":"424723804f6604ec98b4ffe0dcb621e40148726f4cc2a69abebec6ef22d82860","afterSHA256":"424723804f6604ec98b4ffe0dcb621e40148726f4cc2a69abebec6ef22d82860","reason":"Same source body in authored semantic page"},{"oldId":"b-d1d2e95616c60c50a95df1e9","targetId":"b-d1d2e95616c60c50a95df1e9","page":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","operation":"move","beforeSHA256":"5286faba9a733afdf577a2f8139208e84c689669229b91f8d95342728a6e9b94","afterSHA256":"5286faba9a733afdf577a2f8139208e84c689669229b91f8d95342728a6e9b94","reason":"Same source body in authored semantic page"},{"oldId":"b-a9bb29b33a8973c8eaebe768","targetId":"b-a9bb29b33a8973c8eaebe768","page":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","operation":"move","beforeSHA256":"b0597e0846729128c6da1fbd8fdafd20d7d08024a0161e16a7519d196a66ccfd","afterSHA256":"b0597e0846729128c6da1fbd8fdafd20d7d08024a0161e16a7519d196a66ccfd","reason":"Same source body in authored semantic page"},{"oldId":"b-9a1a8e6ffa2de70b95e323b4","targetId":"b-9a1a8e6ffa2de70b95e323b4","page":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","operation":"move","beforeSHA256":"df0fc7ce0dda76e7064435adc9e613d0e10bfd49fdbae31af21c591a705dfd40","afterSHA256":"df0fc7ce0dda76e7064435adc9e613d0e10bfd49fdbae31af21c591a705dfd40","reason":"Same source body in authored semantic page"},{"oldId":"b-3ae283ba9af62a9556b48a97","targetId":"b-3ae283ba9af62a9556b48a97","page":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","operation":"move","beforeSHA256":"552a1b3eca044fb54d9567b52e522826e4a2a94e5e320721be50dc3ae901327c","afterSHA256":"552a1b3eca044fb54d9567b52e522826e4a2a94e5e320721be50dc3ae901327c","reason":"Same source body in authored semantic page"},{"oldId":"b-94456f5b70e5afbbf737fa7d","targetId":"b-94456f5b70e5afbbf737fa7d","page":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","operation":"move","beforeSHA256":"c4a00574ebad248e363d05363d2b3c2dc018d6f41426069cd8cfc6383a26099a","afterSHA256":"c4a00574ebad248e363d05363d2b3c2dc018d6f41426069cd8cfc6383a26099a","reason":"Same source body in authored semantic page"},{"oldId":"b-ad9f8d48b184612274508bb9","targetId":"b-ad9f8d48b184612274508bb9","page":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","operation":"move","beforeSHA256":"c9d79598a1ef330a2421a96430640637426294bf84e35e15e3d16d9239075ab7","afterSHA256":"c9d79598a1ef330a2421a96430640637426294bf84e35e15e3d16d9239075ab7","reason":"Same source body in authored semantic page"},{"oldId":"b-ad602e7b13bc7bceff4a2718","targetId":"b-ad602e7b13bc7bceff4a2718","page":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","operation":"move","beforeSHA256":"96a3da15a0b50af11eb0ad08fc9c2c6e0e667b75ad40e97ffd02f0cb13c3d452","afterSHA256":"96a3da15a0b50af11eb0ad08fc9c2c6e0e667b75ad40e97ffd02f0cb13c3d452","reason":"Same source body in authored semantic page"},{"oldId":"b-c32210ea88a131fdfb41f5f1","targetId":"b-c32210ea88a131fdfb41f5f1","page":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","operation":"move","beforeSHA256":"d8a4bf3e975f6b911cd75779aa5377f17050a2cf1d1027fee5860082f93a63f3","afterSHA256":"d8a4bf3e975f6b911cd75779aa5377f17050a2cf1d1027fee5860082f93a63f3","reason":"Same source body in authored semantic page"},{"oldId":"b-f10a6d2ac409c19b475f134d","targetId":"b-f10a6d2ac409c19b475f134d","page":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","operation":"move","beforeSHA256":"21bb6e9d24de7d819fd0060213e2fee00ec3461ad2a684a585cf52fa3a0bc7fa","afterSHA256":"21bb6e9d24de7d819fd0060213e2fee00ec3461ad2a684a585cf52fa3a0bc7fa","reason":"Same source body in authored semantic page"},{"oldId":"b-8c36c117383c038ba26f9c73","targetId":"b-8c36c117383c038ba26f9c73","page":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","operation":"move","beforeSHA256":"743f7ff001688d3fd8f001607314747499c29a834f3a8b57ba4de33a50791ae0","afterSHA256":"743f7ff001688d3fd8f001607314747499c29a834f3a8b57ba4de33a50791ae0","reason":"Same source body in authored semantic page"},{"oldId":"b-dbfa4df0ae12ee79b48efb40","targetId":"b-dbfa4df0ae12ee79b48efb40","page":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","operation":"move","beforeSHA256":"79eaaaffdd9882253c3916d1ebaac1d9ea507abf90c5b0ba17bb95322c3f0d2b","afterSHA256":"79eaaaffdd9882253c3916d1ebaac1d9ea507abf90c5b0ba17bb95322c3f0d2b","reason":"Same source body in authored semantic page"},{"oldId":"b-32fe794b46b0500c14a666d6","targetId":"b-32fe794b46b0500c14a666d6","page":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","operation":"rewrite","beforeSHA256":"d46c953ffc583e62a10a6c9c36c7682bf1a38745d2cc99fecb3623c56b0c7a17","afterSHA256":"53726d629b4dafcabac379f9dd5cf5f4b89b047d69a58976455e58267facdd6e","reason":"Same source identity with figure semantics or reading context enriched"},{"oldId":"b-e38d3282b6de47f653964293","targetId":"b-e38d3282b6de47f653964293","page":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","operation":"move","beforeSHA256":"1fb03d6956b1cd8ef67bdc56700240174a115de5a8510417f236f504b2f0f94b","afterSHA256":"1fb03d6956b1cd8ef67bdc56700240174a115de5a8510417f236f504b2f0f94b","reason":"Same source body in authored semantic page"},{"oldId":"b-025f83bba3b7a75052d834fe","targetId":"b-025f83bba3b7a75052d834fe","page":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","operation":"move","beforeSHA256":"3e99597f362c701010faa3a4aad3ea21d721a31a6326ee28c2a294cf5f79e0af","afterSHA256":"3e99597f362c701010faa3a4aad3ea21d721a31a6326ee28c2a294cf5f79e0af","reason":"Same source body in authored semantic page"},{"oldId":"b-9ee8b053fc9b1b6b94863407","targetId":"b-9ee8b053fc9b1b6b94863407","page":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","operation":"move","beforeSHA256":"029cb931c3edb8821ff9b7edf711311a13733d22e8595f026b8fb2d357d57806","afterSHA256":"029cb931c3edb8821ff9b7edf711311a13733d22e8595f026b8fb2d357d57806","reason":"Same source body in authored semantic page"},{"oldId":"b-17aaaed3497664782597be70","targetId":"b-17aaaed3497664782597be70","page":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","operation":"move","beforeSHA256":"dd03c7cb5256b2c557373e639baac15bbd9be86a0a2468ba58e264c937a0f071","afterSHA256":"dd03c7cb5256b2c557373e639baac15bbd9be86a0a2468ba58e264c937a0f071","reason":"Same source body in authored semantic page"},{"oldId":"b-ccbf4ff54af11c3ca79b71d1","targetId":"b-ccbf4ff54af11c3ca79b71d1","page":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","operation":"move","beforeSHA256":"34bff16da9169f6f9707284e6832f14d88f007b3a1f1a7410c4c43d463d13ac3","afterSHA256":"34bff16da9169f6f9707284e6832f14d88f007b3a1f1a7410c4c43d463d13ac3","reason":"Same source body in authored semantic page"},{"oldId":"b-98acfa628f3e84752a6d2fe1","targetId":"b-98acfa628f3e84752a6d2fe1","page":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","operation":"move","beforeSHA256":"e6a3867ce2abb1ebb362d6010a21de0a15396b7f6d5397d6e758f541f9783b5f","afterSHA256":"e6a3867ce2abb1ebb362d6010a21de0a15396b7f6d5397d6e758f541f9783b5f","reason":"Same source body in authored semantic page"},{"oldId":"b-47ad384b31d4a9fa49e7fc03","targetId":"b-47ad384b31d4a9fa49e7fc03","page":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","operation":"move","beforeSHA256":"eb6100ae069e0f2e80cad437e18f1b80d5fd52c209b2ebc6776b351784ef84db","afterSHA256":"eb6100ae069e0f2e80cad437e18f1b80d5fd52c209b2ebc6776b351784ef84db","reason":"Same source body in authored semantic page"},{"oldId":"b-08ff83364b2017f8a6d3265d","targetId":"b-08ff83364b2017f8a6d3265d","page":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","operation":"move","beforeSHA256":"cbe6b81393f1f3d96060c19c28c6a4d2b85c3b2cb3bf2802e095a77295f423c3","afterSHA256":"cbe6b81393f1f3d96060c19c28c6a4d2b85c3b2cb3bf2802e095a77295f423c3","reason":"Same source body in authored semantic page"},{"oldId":"b-1218c97f5b9f1f6fdf4d345d","targetId":"b-1218c97f5b9f1f6fdf4d345d","page":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","operation":"move","beforeSHA256":"051a9ece573f3d246724abacb6eec739dc0d36eff118c8253281e204b5df3d18","afterSHA256":"051a9ece573f3d246724abacb6eec739dc0d36eff118c8253281e204b5df3d18","reason":"Same source body in authored semantic page"}],"blocks":[{"id":"b-6b65e05695e554af6d0209e5","type":"h1","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-6b65e05695e554af6d0209e5","content":"# LAB 02 · 参数迁移：冻结、局部与全量微调","sha256":"8339f90807c2cbbd91da21ef315a124b87950f2f9373d30fbbdf45c39e9a74c0","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-911802c7fc6227790199c9f8","prerequisites":[{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-911802c7fc6227790199c9f8","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-911802c7fc6227790199c9f8","content":"按问题继续","sha256":"e91f24e4e4ca40e2099a0d81d30db6568f4bf2074b499eeee6e3959617bd97ac","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-6b65e05695e554af6d0209e5","nextBlock":"b-eb32dc41c0593ca3db31117f","prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"}],"relatedBlocks":[]},{"id":"b-eb32dc41c0593ca3db31117f","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-eb32dc41c0593ca3db31117f","content":"同源参数的冻结/局部/全量/scratch与BN模式辨析","sha256":"5f1e2e7a35a6afaca427b0b03cfec448b4aac4324b16108f14671986a2d98b38","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-911802c7fc6227790199c9f8","nextBlock":"b-76e3a6cf3cd0684c4413b1ee","prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"},{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-76e3a6cf3cd0684c4413b1ee","type":"p","scope":"document","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-76e3a6cf3cd0684c4413b1ee","content":"可先阅读已有结果，再决定是否运行。重算时请核对各节记录的数据、参数、环境与日期。","sha256":"f22152fd55dcdb0090b5653d37145694fd19388d31e10226549464fe8b483578","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-eb32dc41c0593ca3db31117f","nextBlock":"b-471329e7af841d8d69fc0662","prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"},{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-471329e7af841d8d69fc0662","type":"p","scope":"block-60d63838f97a43df9e3cf8ed118ce0da","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-471329e7af841d8d69fc0662","content":"**学习路径：** [表示怎样迁移到新任务](/course/study/readout-transfer.html)","sha256":"efc07be0d238c97b2a0f2a3e1e141f27691e7d1aadb5b0bc2662d7d40218327f","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-76e3a6cf3cd0684c4413b1ee","nextBlock":"b-5a459cd95c8c2f5fffd0f55e","prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"},{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-5a459cd95c8c2f5fffd0f55e","type":"p","scope":"block-60d63838f97a43df9e3cf8ed118ce0da","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-5a459cd95c8c2f5fffd0f55e","content":"**允许改变参数以后，已有权重是否比从头训练更有用？**","sha256":"1ce2327a72de3b56c61487d99fcf335697039073a22eabe9e80a832af0210b94","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-471329e7af841d8d69fc0662","nextBlock":"b-8f6eebb6181e7b8146e16987","prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"},{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-8f6eebb6181e7b8146e16987","type":"p","scope":"block-60d63838f97a43df9e3cf8ed118ce0da","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-8f6eebb6181e7b8146e16987","content":"先读目标数字图和四臂参数范围：只训练新头、解冻后部、全部微调、随机起点。随后只按验证交叉熵选择停点和方案，最后读取保留评价。保存协议中scratch较好；用它检查“迁移必然获益”的直觉，而不是换一套口径把结果改好。","sha256":"4c7762221f1bc0b89815a6ad7702b267278cd03cd6cfc6923f649d8cf97ca501","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-5a459cd95c8c2f5fffd0f55e","nextBlock":"b-e35385ff6c4dbc4aaed0c13a","prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"},{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-e35385ff6c4dbc4aaed0c13a","type":"p","scope":"block-60d63838f97a43df9e3cf8ed118ce0da","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-e35385ff6c4dbc4aaed0c13a","content":"留下四行比较，写清起点、哪些参数更新、验证选择与保留结果。[P23](/course/pages/l3-r2-p23.html)区分冻结读出和微调，[解释这次负结果](/course/blocks/adaptation-scope-and-negative-result.html)说明能带走的判断。","sha256":"6133de7dfaf36f19f786d9511c3ec0671a95209420e4ec93f9cd36ac8bc587a7","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-8f6eebb6181e7b8146e16987","nextBlock":"b-b3df06406beb59755eda207c","prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"},{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-b3df06406beb59755eda207c","type":"p","scope":"block-60d63838f97a43df9e3cf8ed118ce0da","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-b3df06406beb59755eda207c","content":"输入是MNIST数字≥5，叶片图只是应用情境。重算从准备单元开始，保持源checkpoint不变；需要新结论时另留评价集。只想判断现成表示而不改参数，请用[LAB 01](https://deepnote.com/project/38755e4e-23f6-4f5f-8c68-8a2e4114b1c1/notebook/4dd8605ed9904820919ea9e13d9e7d7c)。","sha256":"0c6bcd22b6e25f16c071abc776e71f1a7d4c003d0cfac515b5552bcc902db63c","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-e35385ff6c4dbc4aaed0c13a","nextBlock":"b-432affd591d4f5d4cec3e07b","prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"},{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-432affd591d4f5d4cec3e07b","type":"p","scope":"block-67b8a90d213841e2a0334bd1cf4a5e9d","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-432affd591d4f5d4cec3e07b","content":"第三讲课堂停点：[复用表示的理由](/#/l3-r2-p23/0) → [三种更新范围](/#/l3-r2-p23/0)。","sha256":"a57afd051b75313373fc15acb807f4e5e18dc1164690bd33623d9d5e5a01cd39","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-b3df06406beb59755eda207c","nextBlock":"b-b0039765f4898eb701efa6ba","prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"},{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-b0039765f4898eb701efa6ba","type":"p","scope":"block-67b8a90d213841e2a0334bd1cf4a5e9d","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-b0039765f4898eb701efa6ba","content":"[CLS 01 · 学习信号、表示与迁移](/course/c02-signals.html) · [第三讲导读](/course/guide.html)","sha256":"846c98446c2fa9745117fb7e7656e32d8c465a172d25edbc2cff11503ff8a41b","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-432affd591d4f5d4cec3e07b","nextBlock":"b-13e4a4e455829811b8c182f2","prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"},{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-13e4a4e455829811b8c182f2","type":"p","scope":"block-67b8a90d213841e2a0334bd1cf4a5e9d","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-13e4a4e455829811b8c182f2","content":"![白底叶片采集与温室复杂背景中的叶片观察](/assets/display/a28a701a042f8c6410b0b127.webp)","sha256":"297a6a89ce67eac19a4987a19e76cdf9239a0e87a037a553fbd125b1f946b035","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-b0039765f4898eb701efa6ba","nextBlock":"b-6c963d4b89f9d68116ae8d60","prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"},{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-6c963d4b89f9d68116ae8d60","type":"p","scope":"block-67b8a90d213841e2a0334bd1cf4a5e9d","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-6c963d4b89f9d68116ae8d60","content":"假设任务，效果待验证；AIGC情境插图。","sha256":"4514df1fa225ba31be50281a7673f6cf07f17391889f25df198e0968e331f3fe","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-13e4a4e455829811b8c182f2","nextBlock":"b-890bca68358d4c8464e163d1","prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"},{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-890bca68358d4c8464e163d1","type":"p","scope":"block-67b8a90d213841e2a0334bd1cf4a5e9d","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-890bca68358d4c8464e163d1","content":"**先从图上找复用的理由，也找改变的条件。** 同一个叶片识别任务，从白底固定拍摄走向温室：叶缘、叶脉和局部纹理仍可能有用；光照、尺度、背景和遮挡却发生变化。已有表示因此值得作为起点，但“值得试”之后，还要比较冻结、局部解冻和全部更新。","sha256":"4cb8dfb4b49ec0c9d9515b9fe867a03b415ee588ae198b4df85a646b0a16ae33","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-6c963d4b89f9d68116ae8d60","nextBlock":"b-48a88fb080874f6d82ee1051","prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"},{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-48a88fb080874f6d82ee1051","type":"p","scope":"block-67b8a90d213841e2a0334bd1cf4a5e9d","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-48a88fb080874f6d82ee1051","content":"为让你现在就能动手，本页实际运行的是有真实标签的**数字是否 ≥5**：源任务为十类 MNIST，新任务为二分类。它练习相同的比较方法，结果属于数字任务。","sha256":"4d912dfa8a0b740bc65ae32f6bc894e5f483da61da3821e43d66daacfea2c667","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-890bca68358d4c8464e163d1","nextBlock":"b-ddcfec1d821272bb314ecd51","prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"},{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-ddcfec1d821272bb314ecd51","type":"p","scope":"block-67b8a90d213841e2a0334bd1cf4a5e9d","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-ddcfec1d821272bb314ecd51","content":"本独立包携带原 L02-LAB 02 checkpoint、原报告和官方 MNIST 文件；无需访问其他项目的运行内存或文件。加载时校验 SHA-256。新任务 640 张图均来自源训练/源验证未用的官方训练索引，划分为 256 训练、128 验证、256 保留评价。缺少书写者分组，不能声称控制了书写者泄漏。用验证选择，最后查看保留集。","sha256":"821891af1b69990a1122e6e8d5a062992dedfbb4e58c62b7eaa4ec9ba8bc2005","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-48a88fb080874f6d82ee1051","nextBlock":"b-95b15cd7f7df38aa108e0cce","prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"},{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-95b15cd7f7df38aa108e0cce","type":"p","scope":"block-67b8a90d213841e2a0334bd1cf4a5e9d","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-95b15cd7f7df38aa108e0cce","content":"下面在 CPU 上比较三种迁移范围和一个从头训练对照，默认各 4 轮。耗时依环境而定；先读取项目中的数据和模型文件，无付费接口或新增作业义务。","sha256":"a386e1d2973766b77657afcace445a7585e4d46a25b3d3e1aaaf454c261c411f","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-opening","title":"LAB 02 · 参数迁移：冻结、局部与全量微调","number":1},"sectionTitle":"LAB 02 · 参数迁移：冻结、局部与全量微调","currentQuestion":"LAB 02 · 参数迁移：冻结、局部与全量微调","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-ddcfec1d821272bb314ecd51","nextBlock":null,"prerequisites":[{"id":"b-6b65e05695e554af6d0209e5","url":"#b-6b65e05695e554af6d0209e5","role":"section-title"},{"id":"b-911802c7fc6227790199c9f8","url":"#b-911802c7fc6227790199c9f8","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-e2a13dbc2bd49ef7fd293729","type":"h3","scope":"block-ee8a87d747b242478019aba89d2e46d3","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-e2a13dbc2bd49ef7fd293729","content":"### 准备：本实验的固定材料","sha256":"58943d8a10b53cc66740a7eaa1e71f8fa71ae3c3ad01f2fe55418251a3986e98","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-ee8a87d747b242478019aba89d2e46d3","title":"准备：本实验的固定材料","number":2},"sectionTitle":"准备：本实验的固定材料","currentQuestion":"准备：本实验的固定材料","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-5a6ac756a61b19ffc7d3553f","prerequisites":[{"id":"b-5a6ac756a61b19ffc7d3553f","url":"#b-5a6ac756a61b19ffc7d3553f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-5a6ac756a61b19ffc7d3553f","type":"p","scope":"block-248fcbe45bd74a248982c64b5c7877c5","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-5a6ac756a61b19ffc7d3553f","content":"**先读保存结果，再决定是否重算。** 原教师曲线与输入图仍内嵌在本册，历史数值位于 `historical-v16/`。","sha256":"629b478c7fe01588b8416b1bd41f4491c95e201282d93a0f5eb2bc35817a410b","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-ee8a87d747b242478019aba89d2e46d3","title":"准备：本实验的固定材料","number":2},"sectionTitle":"准备：本实验的固定材料","currentQuestion":"准备：本实验的固定材料","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-e2a13dbc2bd49ef7fd293729","nextBlock":"b-568245e693190f2e5570743b","prerequisites":[{"id":"b-e2a13dbc2bd49ef7fd293729","url":"#b-e2a13dbc2bd49ef7fd293729","role":"section-title"}],"relatedBlocks":[]},{"id":"b-568245e693190f2e5570743b","type":"p","scope":"block-248fcbe45bd74a248982c64b5c7877c5","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-568245e693190f2e5570743b","content":"在当前项目中使用 `lab09-transfer/`。下面的准备代码先检查该目录，若缺失则下载本讲原站的完整包并安全解压；已有文件不覆盖。包内含 `results/cnn-plain-state.pt`、`results/lab02-results.json` 和两份官方 MNIST 训练文件，无须先运行第二讲 notebook。","sha256":"db71370d749b53729b1253732f65ddc5df6211d8d4deb575f8fff2eea4030213","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-ee8a87d747b242478019aba89d2e46d3","title":"准备：本实验的固定材料","number":2},"sectionTitle":"准备：本实验的固定材料","currentQuestion":"准备：本实验的固定材料","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-5a6ac756a61b19ffc7d3553f","nextBlock":"b-02cc02f00d19b77d092ea42a","prerequisites":[{"id":"b-e2a13dbc2bd49ef7fd293729","url":"#b-e2a13dbc2bd49ef7fd293729","role":"section-title"},{"id":"b-5a6ac756a61b19ffc7d3553f","url":"#b-5a6ac756a61b19ffc7d3553f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-02cc02f00d19b77d092ea42a","type":"p","scope":"block-248fcbe45bd74a248982c64b5c7877c5","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-02cc02f00d19b77d092ea42a","content":"安装该目录 `requirements.txt` 后从本册顺序运行。模型、数据和源划分会逐项核对；训练四臂是学生可选操作，保存结果已经足以完成讨论。","sha256":"55255cb059dec3efe2a47cad7fea9054dce0ec22249f51f1c8cbdd2500cdc5f1","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-ee8a87d747b242478019aba89d2e46d3","title":"准备：本实验的固定材料","number":2},"sectionTitle":"准备：本实验的固定材料","currentQuestion":"准备：本实验的固定材料","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-568245e693190f2e5570743b","nextBlock":"b-5239c695c9e432a06604e380","prerequisites":[{"id":"b-e2a13dbc2bd49ef7fd293729","url":"#b-e2a13dbc2bd49ef7fd293729","role":"section-title"},{"id":"b-5a6ac756a61b19ffc7d3553f","url":"#b-5a6ac756a61b19ffc7d3553f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-5239c695c9e432a06604e380","type":"pre","scope":"block-186427ff91eb43f1841c3fb1342dc90a","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-5239c695c9e432a06604e380","content":"```\n# 当前项目中的独立材料：已存在则复用，缺失才从本讲原站准备。\nfrom pathlib import Path\nimport io, zipfile, urllib.request\n_base = Path.cwd()\n_folder = 'lab09-transfer'\n_sentinel = 'data/train-images-idx3-ubyte.gz'\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    _payload = urllib.request.urlopen(_url, timeout=60).read()\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 copy, gzip, hashlib, io, json, os, time\nfrom pathlib import Path\nfrom collections import OrderedDict\nimport numpy as np\nimport matplotlib.pyplot as plt\nfrom matplotlib.patches import Rectangle\nimport torch\nfrom torch import nn\nfrom torch.nn import functional as F\ntorch.set_num_threads(2)\ntorch.manual_seed(20260917)\n\nROOT=LAB_ROOT\nif not (ROOT/'data').is_dir() and (ROOT/'lab09-transfer/data').is_dir():ROOT=ROOT/'lab09-transfer'\nassert (ROOT/'data').is_dir(), '请解压独立 lab09-transfer 包并保留目录结构。'\nOUT=ROOT/'runs/current';OUT.mkdir(parents=True,exist_ok=True)\n\n```","sha256":"9e914efedd4eae705e14123b928f44c3ddc6b8152586aa5cba003c756c27e34c","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-ee8a87d747b242478019aba89d2e46d3","title":"准备：本实验的固定材料","number":2},"sectionTitle":"准备：本实验的固定材料","currentQuestion":"准备：本实验的固定材料","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-02cc02f00d19b77d092ea42a","nextBlock":"b-42bba9f3bddc161502748d69","prerequisites":[{"id":"b-e2a13dbc2bd49ef7fd293729","url":"#b-e2a13dbc2bd49ef7fd293729","role":"section-title"},{"id":"b-5a6ac756a61b19ffc7d3553f","url":"#b-5a6ac756a61b19ffc7d3553f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-42bba9f3bddc161502748d69","type":"p","scope":"block-56ef8a09f7ad45788d3f8dba0f976821","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-42bba9f3bddc161502748d69","content":"**重算入口：**当前项目的 `lab09-transfer/` 是明确文件依赖。清空内存后，从本册准备代码顺序运行；不借用其他 notebook 的变量。","sha256":"440c32dbdc4c8107b5661bdcd8fa46ca99346205535609ee17e2e6f2a31f31b6","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-ee8a87d747b242478019aba89d2e46d3","title":"准备：本实验的固定材料","number":2},"sectionTitle":"准备：本实验的固定材料","currentQuestion":"准备：本实验的固定材料","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-5239c695c9e432a06604e380","nextBlock":"b-c18b482697a99463e0f2cb35","prerequisites":[{"id":"b-e2a13dbc2bd49ef7fd293729","url":"#b-e2a13dbc2bd49ef7fd293729","role":"section-title"},{"id":"b-5a6ac756a61b19ffc7d3553f","url":"#b-5a6ac756a61b19ffc7d3553f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-c18b482697a99463e0f2cb35","type":"pre","scope":"block-cb2b6dec25874e6a9654f27808e15529","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-c18b482697a99463e0f2cb35","content":"```\nMODEL_PATH=ROOT/'results/cnn-plain-state.pt'\nREPORT_PATH=ROOT/'results/lab02-results.json'\nDATA=ROOT/'data'\nfiles={\n 'train-images-idx3-ubyte.gz':'440fcabf73cc546fa21475e81ea370265605f56be210a4024d2ca8f203523609',\n 'train-labels-idx1-ubyte.gz':'3552534a0a558bbed6aed32b30c495cca23d567ec52cac8be1a0730e8010255c'}\nmissing=[str(p) for p in [MODEL_PATH,REPORT_PATH,*[DATA/n for n in files]] if not p.is_file()]\nif missing:\n    raise RuntimeError('独立材料包不完整，请重新解压 data/ 与 results/：'+', '.join(missing))\nreport=json.loads(REPORT_PATH.read_text())\nprotocol=report['protocol']\nassert protocol['split_seed']==20260908 and protocol['train_n']==12000, '本练习要求 LAB 02 默认源训练划分；改变划分后需要重新检查源/目标重叠。'\nraw={}\nfor name,sha in files.items():\n    raw[name]=(DATA/name).read_bytes()\n    assert hashlib.sha256(raw[name]).hexdigest()==sha, 'MNIST 文件不匹配：'+name\nimages=np.frombuffer(gzip.decompress(raw['train-images-idx3-ubyte.gz']),dtype=np.uint8,offset=16).reshape(60000,1,28,28)\ndigit_labels=np.frombuffer(gzip.decompress(raw['train-labels-idx1-ubyte.gz']),dtype=np.uint8,offset=8)\npartition=np.random.default_rng(20260908).permutation(60000)\nexpected_partition_sha=hashlib.sha256(partition.tobytes()).hexdigest()\nexpected_train_sha=hashlib.sha256(partition[:12000].tobytes()).hexdigest()\nexpected_val_sha=hashlib.sha256(partition[50000:].tobytes()).hexdigest()\nassert protocol['train_ids_sha256']==expected_train_sha\nassert protocol['partition_sha256']==expected_partition_sha and protocol['validation_n']==10000\nstate_bytes=MODEL_PATH.read_bytes()\nmodel_sha256=hashlib.sha256(state_bytes).hexdigest()\nCOURSE_MODEL_SHA256='ba8b738cc67d4ec3cd83d75a5dbe8a70ec548377335ba0abaaa7c23cd14eeba3'\nidentity=report.get('checkpoint_provenance',{}).get('cnn-plain-state.pt')\nif identity is not None:\n    assert identity['sha256']==model_sha256, '模型与 LAB 02 报告不是同一轮保存的文件；请重新运行 LAB 02 第4节和保存结果单元。'\n    source=identity['source_protocol']\n    assert source['split_seed']==20260908 and source['train_n']==12000 and source['validation_n']==10000\n    assert source['partition_sha256']==expected_partition_sha\n    assert source['train_ids_sha256']==expected_train_sha and source['validation_ids_sha256']==expected_val_sha\n    source_files={item['file']:item['sha256'] for item in source['files']}\n    assert all(source_files.get(name)==sha for name,sha in files.items()), '源训练数据身份与本练习不一致。'\n    identity_basis='LAB02 training-time checkpoint hash and source protocol'\nelif model_sha256==COURSE_MODEL_SHA256:\n    # 已追溯的课程旧模型兼容旧报告；此分支仅接受这一份确切文件。\n    identity_basis='known course checkpoint SHA-256 with verified default source split'\nelse:\n    raise RuntimeError('当前模型缺少与报告绑定的训练来源。请重新运行更新后的 LAB 02 第4节及保存结果单元；不要给旧文件补写哈希。')\ntarget_ids=partition[12000:12640]\nassert not set(target_ids)&set(partition[:12000])\nassert not set(target_ids)&set(partition[50000:])\ntarget_buffer=io.BytesIO()\nnp.savez_compressed(target_buffer,images=images[target_ids],digit_labels=digit_labels[target_ids],\n official_train_ids=target_ids,split=np.array([0]*256+[1]*128+[2]*256,dtype=np.uint8))\nprovenance={'dataset':'MNIST official training set','source_task':'ten-class digit classification',\n 'source_checkpoint_sha256':model_sha256,'source_identity_basis':identity_basis,'source_origin':'bundled original LAB02 protected checkpoint; cross-project independent package',\n 'target_task':'digit >= 5 (binary)','source_split_seed':20260908,\n 'source_train_permutation_positions':[0,12000],'source_validation_permutation_positions':[50000,60000],\n 'target_permutation_positions':[12000,12640],'target_split_sizes':{'train':256,'validation':128,'heldout':256},\n 'target_ids_sha256':hashlib.sha256(target_ids.tobytes()).hexdigest(),\n 'limitations':['single small digit task','source/target sample indices disjoint; writer groups unavailable','not a leaf experiment']}\nasset_bytes={'cnn-plain-state.pt':state_bytes,'target.npz':target_buffer.getvalue(),\n 'target-provenance.json':json.dumps(provenance).encode()}\nprint('使用包内已核验模型；目标样本与默认源训练/验证索引不重叠。')\n\n```","sha256":"07984659f22edf1a9718250b393647b37fc539bd8865faf43ca5beac4b98fb65","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-ee8a87d747b242478019aba89d2e46d3","title":"准备：本实验的固定材料","number":2},"sectionTitle":"准备：本实验的固定材料","currentQuestion":"准备：本实验的固定材料","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-42bba9f3bddc161502748d69","nextBlock":"b-d6083ce19ddf68167749f765","prerequisites":[{"id":"b-e2a13dbc2bd49ef7fd293729","url":"#b-e2a13dbc2bd49ef7fd293729","role":"section-title"},{"id":"b-5a6ac756a61b19ffc7d3553f","url":"#b-5a6ac756a61b19ffc7d3553f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-d6083ce19ddf68167749f765","type":"pre","scope":"block-97d6413de80249e1986f2ac8fa35a0db","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-d6083ce19ddf68167749f765","content":"```\nsource_state=torch.load(io.BytesIO(asset_bytes['cnn-plain-state.pt']),map_location='cpu',weights_only=True)\ndef make_cnn():\n    return nn.Sequential(OrderedDict([\n      ('conv1',nn.Conv2d(1,8,3,padding=1)),('relu1',nn.ReLU()),('pool1',nn.MaxPool2d(2)),\n      ('conv2',nn.Conv2d(8,16,3,padding=1)),('relu2',nn.ReLU()),('pool2',nn.MaxPool2d(2)),\n      ('flatten',nn.Flatten()),('hidden',nn.Linear(784,32)),('relu3',nn.ReLU()),('logits',nn.Linear(32,10))]))\nsource_model=make_cnn();source_model.load_state_dict(source_state);source_model.eval()\nassert sum(p.numel() for p in source_model.parameters())==26698\nprint('已读取独立包内的 26698 参数 CNN；PyTorch',torch.__version__)\nprint('当前模型 SHA-256:',model_sha256)\n\n```","sha256":"4e8403f272270dbf8b62b8561945ef255842c8d5a118f15592e3f54af0326e72","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-ee8a87d747b242478019aba89d2e46d3","title":"准备：本实验的固定材料","number":2},"sectionTitle":"准备：本实验的固定材料","currentQuestion":"准备：本实验的固定材料","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-c18b482697a99463e0f2cb35","nextBlock":null,"prerequisites":[{"id":"b-e2a13dbc2bd49ef7fd293729","url":"#b-e2a13dbc2bd49ef7fd293729","role":"section-title"},{"id":"b-5a6ac756a61b19ffc7d3553f","url":"#b-5a6ac756a61b19ffc7d3553f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-fda7e8d5359270f23d5ba515","type":"h3","scope":"block-58bc52fbf8f147819e934fbe8e30546a","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-fda7e8d5359270f23d5ba515","content":"### 1. 先写预测，再确定协议","sha256":"fff10c83fb1c7731acdea30738ea12d6c7665a102976f655e1815e0c6a6b05fd","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-58bc52fbf8f147819e934fbe8e30546a","title":"1. 先写预测，再确定协议","number":3},"sectionTitle":"1. 先写预测，再确定协议","currentQuestion":"1. 先写预测，再确定协议","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-53b4b4d8a423e2cf8bc8fa76","prerequisites":[{"id":"b-53b4b4d8a423e2cf8bc8fa76","url":"#b-53b4b4d8a423e2cf8bc8fa76","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-53b4b4d8a423e2cf8bc8fa76","type":"p","scope":"block-dedeadf5249d49bcb62e1ae35677dada","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-53b4b4d8a423e2cf8bc8fa76","content":"**标签变了，输入的笔画还在。** 下面是目标训练集的前 8 个例子；y=1 表示数字 ≥5，y=0 表示数字 <5。","sha256":"6320b48d910d74528b03f0c49a483751c114c81600f6bed611660eb2b3999c61","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-58bc52fbf8f147819e934fbe8e30546a","title":"1. 先写预测，再确定协议","number":3},"sectionTitle":"1. 先写预测，再确定协议","currentQuestion":"1. 先写预测，再确定协议","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-fda7e8d5359270f23d5ba515","nextBlock":"b-c5736377f6cdb7018ac4f0dd","prerequisites":[{"id":"b-fda7e8d5359270f23d5ba515","url":"#b-fda7e8d5359270f23d5ba515","role":"section-title"}],"relatedBlocks":[]},{"id":"b-c5736377f6cdb7018ac4f0dd","type":"p","scope":"block-dedeadf5249d49bcb62e1ae35677dada","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-c5736377f6cdb7018ac4f0dd","content":"![真实目标训练样本及数字是否大于等于5的新标签](/assets/display/4b8038d5a4d30dbb2d163963.webp)","sha256":"1a6f72d0996ad9890c56d6281429fdd5a78b53d097529d9c51bc27befd66c40a","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-58bc52fbf8f147819e934fbe8e30546a","title":"1. 先写预测，再确定协议","number":3},"sectionTitle":"1. 先写预测，再确定协议","currentQuestion":"1. 先写预测，再确定协议","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-53b4b4d8a423e2cf8bc8fa76","nextBlock":"b-3e25f7d3d45af340f232b0c2","prerequisites":[{"id":"b-fda7e8d5359270f23d5ba515","url":"#b-fda7e8d5359270f23d5ba515","role":"section-title"},{"id":"b-53b4b4d8a423e2cf8bc8fa76","url":"#b-53b4b4d8a423e2cf8bc8fa76","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-3e25f7d3d45af340f232b0c2","type":"p","scope":"block-dedeadf5249d49bcb62e1ae35677dada","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-3e25f7d3d45af340f232b0c2","content":"已保存的默认输入：官方 MNIST 训练图像，按本页固定索引取样，灰度除以 255，统一右移 2 像素、边界补零。图来自此前本地执行；不是叶片数据或生成数字。","sha256":"1cb3a431652e3f862ec1768e31c00f6c361b2759fc0c3a1765f8608490118fef","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-58bc52fbf8f147819e934fbe8e30546a","title":"1. 先写预测，再确定协议","number":3},"sectionTitle":"1. 先写预测，再确定协议","currentQuestion":"1. 先写预测，再确定协议","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-c5736377f6cdb7018ac4f0dd","nextBlock":"b-b5ef3825402fada05b16e817","prerequisites":[{"id":"b-fda7e8d5359270f23d5ba515","url":"#b-fda7e8d5359270f23d5ba515","role":"section-title"},{"id":"b-53b4b4d8a423e2cf8bc8fa76","url":"#b-53b4b4d8a423e2cf8bc8fa76","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-b5ef3825402fada05b16e817","type":"p","scope":"block-dedeadf5249d49bcb62e1ae35677dada","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-b5ef3825402fada05b16e817","content":"源表示见过数字形态，却没用过这 640 个样本。已有表示是否有用、冻结是否足够、解冻越多是否越好，是三个不同问题。先选你预计最好的方案，并写一个可能推翻判断的结果。","sha256":"77dbd1f9649c64d06ce84e4e168648f2822474f98473b06b0c88310331d3e6a0","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-58bc52fbf8f147819e934fbe8e30546a","title":"1. 先写预测，再确定协议","number":3},"sectionTitle":"1. 先写预测，再确定协议","currentQuestion":"1. 先写预测，再确定协议","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-3e25f7d3d45af340f232b0c2","nextBlock":"b-1d81dc30e4c2e9598107beca","prerequisites":[{"id":"b-fda7e8d5359270f23d5ba515","url":"#b-fda7e8d5359270f23d5ba515","role":"section-title"},{"id":"b-53b4b4d8a423e2cf8bc8fa76","url":"#b-53b4b4d8a423e2cf8bc8fa76","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-1d81dc30e4c2e9598107beca","type":"p","scope":"block-dedeadf5249d49bcb62e1ae35677dada","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-1d81dc30e4c2e9598107beca","content":"`TRAIN_LIMIT` 控制训练量，`DX` 控制固定水平位移，`EPOCHS` 控制轮数；先运行默认值。三种迁移共用源检查点、新头初始化、批次顺序、优化器和预算。可更新参数与每步计算成本不同，不能称为等算力比较；从头训练检验起点的作用。改协议后就是新实验。","sha256":"4fd422fc9b896a8f7f426ed1d1d0fa03231376c7acf1f17de28d1fe58410c68a","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-58bc52fbf8f147819e934fbe8e30546a","title":"1. 先写预测，再确定协议","number":3},"sectionTitle":"1. 先写预测，再确定协议","currentQuestion":"1. 先写预测，再确定协议","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-b5ef3825402fada05b16e817","nextBlock":"b-a508c68451fcf22faca6d7b9","prerequisites":[{"id":"b-fda7e8d5359270f23d5ba515","url":"#b-fda7e8d5359270f23d5ba515","role":"section-title"},{"id":"b-53b4b4d8a423e2cf8bc8fa76","url":"#b-53b4b4d8a423e2cf8bc8fa76","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-a508c68451fcf22faca6d7b9","type":"pre","scope":"block-97b118d3eb0d429aaf8b3875bda3f348","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-a508c68451fcf22faca6d7b9","content":"```\nTRAIN_LIMIT=256\nDX=2\nEPOCHS=4\nBATCH_SIZE=64\nLEARNING_RATE=0.002\nSEED=20260917\nwith np.load(io.BytesIO(asset_bytes['target.npz']),allow_pickle=False) as z:\n    target={k:z[k].copy() for k in z.files}\nprovenance=json.loads(asset_bytes['target-provenance.json'])\nassert 16<=TRAIN_LIMIT<=256 and -4<=DX<=4 and EPOCHS>=1\nx=torch.tensor(target['images'],dtype=torch.float32)/255\ndef shift_x(a,dx):\n    b=torch.zeros_like(a)\n    if dx>=0:b[:,:,:,dx:]=a[:,:,:,:a.shape[-1]-dx]\n    else:b[:,:,:,:dx]=a[:,:,:,-dx:]\n    return b\nx=shift_x(x,DX)\ny=torch.tensor((target['digit_labels']>=5).astype(np.int64))\ntrain_idx=np.flatnonzero(target['split']==0)[:TRAIN_LIMIT]\nval_idx=np.flatnonzero(target['split']==1)\nheldout_idx=np.flatnonzero(target['split']==2)\ntrain_x,train_y=x[train_idx],y[train_idx]\nval_x,val_y=x[val_idx],y[val_idx]\nassert len(set(target['official_train_ids']))==640\nassert not set(train_idx)&set(val_idx) and not set(train_idx)&set(heldout_idx)\nprint('训练/验证/保留：',len(train_idx),len(val_idx),len(heldout_idx),'固定横移',DX)\nprint('训练标签计数',torch.bincount(train_y,minlength=2).tolist(),'验证标签计数',torch.bincount(val_y,minlength=2).tolist())\nfig,axes=plt.subplots(1,8,figsize=(12,2))\nfor i,ax in enumerate(axes):\n    ax.imshow(train_x[i,0],cmap='gray',vmin=0,vmax=1);ax.set_title(f'digit {target[\"digit_labels\"][train_idx[i]]}: y={train_y[i].item()}');ax.axis('off')\nplt.show()\n\n```","sha256":"02d74538e6f7284ba314ae174996ba31ae91ac9421566e640487993906ec5454","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-58bc52fbf8f147819e934fbe8e30546a","title":"1. 先写预测，再确定协议","number":3},"sectionTitle":"1. 先写预测，再确定协议","currentQuestion":"1. 先写预测，再确定协议","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-1d81dc30e4c2e9598107beca","nextBlock":null,"prerequisites":[{"id":"b-fda7e8d5359270f23d5ba515","url":"#b-fda7e8d5359270f23d5ba515","role":"section-title"},{"id":"b-53b4b4d8a423e2cf8bc8fa76","url":"#b-53b4b4d8a423e2cf8bc8fa76","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-96cf66715d55641293108248","type":"h3","scope":"block-1c379ad583d74af7839f0841395946a8","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-96cf66715d55641293108248","content":"### 2. “冻住”到底冻住哪些参数？","sha256":"f151546c7a62df6bf209e28a32ba66ee3bc3f9a04df7f0d2e89a0406d325eca3","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-1c379ad583d74af7839f0841395946a8","title":"2. “冻住”到底冻住哪些参数？","number":4},"sectionTitle":"2. “冻住”到底冻住哪些参数？","currentQuestion":"2. “冻住”到底冻住哪些参数？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-67c35981c49694dc55ed922f","prerequisites":[{"id":"b-67c35981c49694dc55ed922f","url":"#b-67c35981c49694dc55ed922f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-67c35981c49694dc55ed922f","type":"p","scope":"block-066b6fe08efe4c2fbd578d9b716eda96","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-67c35981c49694dc55ed922f","content":"**先沿一行读“从哪里开始”，再读“哪些部分会动”。** 四行都是同一小 CNN 的二分类版本。","sha256":"86bf1e8c8d22a77cd5d030bd8e0042fa511b44104c1da9b3f27c013812b3a926","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-1c379ad583d74af7839f0841395946a8","title":"2. “冻住”到底冻住哪些参数？","number":4},"sectionTitle":"2. “冻住”到底冻住哪些参数？","currentQuestion":"2. “冻住”到底冻住哪些参数？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-96cf66715d55641293108248","nextBlock":"b-26976e14dd68ee119d3e1f57","prerequisites":[{"id":"b-96cf66715d55641293108248","url":"#b-96cf66715d55641293108248","role":"section-title"}],"relatedBlocks":[]},{"id":"b-26976e14dd68ee119d3e1f57","type":"p","scope":"block-066b6fe08efe4c2fbd578d9b716eda96","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-26976e14dd68ee119d3e1f57","content":"![head、late、all、scratch四种起点和可更新参数范围](/assets/display/de50ac0b5652b763013d0e09.webp)","sha256":"ec4c606e694c6dc973809f260ea5c77d113bc6ccd357c194b779fd59c57e4cd4","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-1c379ad583d74af7839f0841395946a8","title":"2. “冻住”到底冻住哪些参数？","number":4},"sectionTitle":"2. “冻住”到底冻住哪些参数？","currentQuestion":"2. “冻住”到底冻住哪些参数？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-67c35981c49694dc55ed922f","nextBlock":"b-bfc43c493868b16acadcf374","prerequisites":[{"id":"b-96cf66715d55641293108248","url":"#b-96cf66715d55641293108248","role":"section-title"},{"id":"b-67c35981c49694dc55ed922f","url":"#b-67c35981c49694dc55ed922f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-bfc43c493868b16acadcf374","type":"p","scope":"block-066b6fe08efe4c2fbd578d9b716eda96","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-bfc43c493868b16acadcf374","content":"结构示意，由本页模型定义与参数计数绘制。灰：读取源参数并冻结；绿：读取源参数并更新；黄：新分类头；蓝：随机起点并更新。图中 66/26354/26434 是可更新参数数，尚不是效果。","sha256":"dead0c8a985006720ce61c896bf6d02cd0fbebf95c7939814f83ada6c43bf3cf","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-1c379ad583d74af7839f0841395946a8","title":"2. “冻住”到底冻住哪些参数？","number":4},"sectionTitle":"2. “冻住”到底冻住哪些参数？","currentQuestion":"2. “冻住”到底冻住哪些参数？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-26976e14dd68ee119d3e1f57","nextBlock":"b-1c6ea9c382704cdf0c1fc142","prerequisites":[{"id":"b-96cf66715d55641293108248","url":"#b-96cf66715d55641293108248","role":"section-title"},{"id":"b-67c35981c49694dc55ed922f","url":"#b-67c35981c49694dc55ed922f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-1c6ea9c382704cdf0c1fc142","type":"p","scope":"block-066b6fe08efe4c2fbd578d9b716eda96","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-1c6ea9c382704cdf0c1fc142","content":"`head` 只更新新头；`late` 更新第二卷积层、32 维隐藏层与新头；`all` 更新全部层。`scratch` 不读预训练权重。**先核对：** late 与 all 只相差 80 个可更新参数，它们对应图中的哪一块？为什么“少解冻一层”不一定意味着参数大幅减少？","sha256":"e580addcfdfa6a676db4a687760666e181c144aa6b64eecc14c054741a4907cd","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-1c379ad583d74af7839f0841395946a8","title":"2. “冻住”到底冻住哪些参数？","number":4},"sectionTitle":"2. “冻住”到底冻住哪些参数？","currentQuestion":"2. “冻住”到底冻住哪些参数？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-bfc43c493868b16acadcf374","nextBlock":"b-1d802c5157c989ab10c58007","prerequisites":[{"id":"b-96cf66715d55641293108248","url":"#b-96cf66715d55641293108248","role":"section-title"},{"id":"b-67c35981c49694dc55ed922f","url":"#b-67c35981c49694dc55ed922f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-1d802c5157c989ab10c58007","type":"p","scope":"block-066b6fe08efe4c2fbd578d9b716eda96","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-1d802c5157c989ab10c58007","content":"代码会实际核对可更新参数。这个模型没有 BatchNorm 或 Dropout；含这些层时，冻结参数还需单独决定模式与状态，见[第二讲 LAB05 · 经典架构与视觉表示](https://codingai-lec02.pages.dev/course/lab05.html)与[第二讲 LAB03 · 架构实验室](https://codingai-lec02.pages.dev/course/lab03.html)。","sha256":"67184c6695a342ff12be15f55b2cad092ca136d235bb452372876edea329e49b","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-1c379ad583d74af7839f0841395946a8","title":"2. “冻住”到底冻住哪些参数？","number":4},"sectionTitle":"2. “冻住”到底冻住哪些参数？","currentQuestion":"2. “冻住”到底冻住哪些参数？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-1c6ea9c382704cdf0c1fc142","nextBlock":"b-d4077e76b03ee044cd49235b","prerequisites":[{"id":"b-96cf66715d55641293108248","url":"#b-96cf66715d55641293108248","role":"section-title"},{"id":"b-67c35981c49694dc55ed922f","url":"#b-67c35981c49694dc55ed922f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-d4077e76b03ee044cd49235b","type":"pre","scope":"block-79753dc070ca46108d4cc8ab56dbe083","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-d4077e76b03ee044cd49235b","content":"```\nMODES=['head','late','all','scratch']\ndef make_target_model(mode):\n    assert mode in MODES\n    torch.manual_seed(SEED)\n    model=make_cnn()\n    if mode!='scratch':model.load_state_dict(source_state)\n    torch.manual_seed(SEED+1)\n    model.logits=nn.Linear(32,2)\n    for name,param in model.named_parameters():\n        param.requires_grad_(mode in ('all','scratch') or name.startswith('logits.') or (mode=='late' and name.startswith(('conv2.','hidden.'))))\n    return model\nscope_table=[]\nfor mode in MODES:\n    model=make_target_model(mode)\n    scope_table.append({'mode':mode,'trainable':sum(p.numel() for p in model.parameters() if p.requires_grad),'total':sum(p.numel() for p in model.parameters())})\nprint(json.dumps(scope_table,indent=2))\n\n```","sha256":"50df0b56441a59cc0172558e60fc91669887bef661ad949627c013ccd35dbf34","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-1c379ad583d74af7839f0841395946a8","title":"2. “冻住”到底冻住哪些参数？","number":4},"sectionTitle":"2. “冻住”到底冻住哪些参数？","currentQuestion":"2. “冻住”到底冻住哪些参数？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-1d802c5157c989ab10c58007","nextBlock":null,"prerequisites":[{"id":"b-96cf66715d55641293108248","url":"#b-96cf66715d55641293108248","role":"section-title"},{"id":"b-67c35981c49694dc55ed922f","url":"#b-67c35981c49694dc55ed922f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-8fbe6142d48e42cb1941e67d","type":"h3","scope":"block-0495306a95d840a5837582faa71e8a04","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-8fbe6142d48e42cb1941e67d","content":"### 3. 运行比较：用验证集选每组的停点","sha256":"e4e3c4d0cfa9f8dc4bd8eee648560a8ff2ff2c4d020188e1a0a421fa8986a00f","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-0495306a95d840a5837582faa71e8a04","title":"3. 运行比较：用验证集选每组的停点","number":5},"sectionTitle":"3. 运行比较：用验证集选每组的停点","currentQuestion":"3. 运行比较：用验证集选每组的停点","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-86a20a34b5aac7ffdbf8de1a","prerequisites":[{"id":"b-86a20a34b5aac7ffdbf8de1a","url":"#b-86a20a34b5aac7ffdbf8de1a","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-86a20a34b5aac7ffdbf8de1a","type":"p","scope":"block-d3888686b40d4fe0a93aac929dce690a","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-86a20a34b5aac7ffdbf8de1a","content":"**先看一个真实的、可能推翻直觉的参考结果。** 每轮结束冻结当前模型计算训练与验证交叉熵，各组保留验证交叉熵最低的检查点。","sha256":"08dcf22268615760559a490d3f823d319cf0ae8c6fccbcf76fb5f6b09ff63fc8","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-0495306a95d840a5837582faa71e8a04","title":"3. 运行比较：用验证集选每组的停点","number":5},"sectionTitle":"3. 运行比较：用验证集选每组的停点","currentQuestion":"3. 运行比较：用验证集选每组的停点","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-8fbe6142d48e42cb1941e67d","nextBlock":"b-a9d1329cf78f5da5327bc9f8","prerequisites":[{"id":"b-8fbe6142d48e42cb1941e67d","url":"#b-8fbe6142d48e42cb1941e67d","role":"section-title"}],"relatedBlocks":[]},{"id":"b-a9d1329cf78f5da5327bc9f8","type":"p","scope":"block-d3888686b40d4fe0a93aac929dce690a","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-a9d1329cf78f5da5327bc9f8","content":"![四种训练范围的真实训练和验证损失，scratch在本协议中最低](/assets/display/47c2e01ecbe2f0f54b67b0cb.webp)","sha256":"baf347de31235f91376833124bba944375185aab9f5623cf91cdc5e8a698fa04","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-0495306a95d840a5837582faa71e8a04","title":"3. 运行比较：用验证集选每组的停点","number":5},"sectionTitle":"3. 运行比较：用验证集选每组的停点","currentQuestion":"3. 运行比较：用验证集选每组的停点","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-86a20a34b5aac7ffdbf8de1a","nextBlock":"b-ca04318e7e053ef604ea787c","prerequisites":[{"id":"b-8fbe6142d48e42cb1941e67d","url":"#b-8fbe6142d48e42cb1941e67d","role":"section-title"},{"id":"b-86a20a34b5aac7ffdbf8de1a","url":"#b-86a20a34b5aac7ffdbf8de1a","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-ca04318e7e053ef604ea787c","type":"p","scope":"block-d3888686b40d4fe0a93aac929dce690a","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-ca04318e7e053ef604ea787c","content":"已保存本地运行：课件源检查点 `ba8b738c…14eeba3`，256 训练/128 验证，统一右移 2px，seed=20260917，Adam lr=.002，batch=64，各 4 轮。两图纵轴相同；右图空心圈是各组所选停点。最低验证 CE：head 1.906、late .877、all .849、scratch .611。本图读取已保存数值绘制；没有把它写成此次 Deepnote 云端输出。","sha256":"89f96008cc20d30f5de04d1703f446613d73a26bcc8a3adfa0ff4da6ee1b9c51","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-0495306a95d840a5837582faa71e8a04","title":"3. 运行比较：用验证集选每组的停点","number":5},"sectionTitle":"3. 运行比较：用验证集选每组的停点","currentQuestion":"3. 运行比较：用验证集选每组的停点","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-a9d1329cf78f5da5327bc9f8","nextBlock":"b-ad98c14db657ee76236d99c5","prerequisites":[{"id":"b-8fbe6142d48e42cb1941e67d","url":"#b-8fbe6142d48e42cb1941e67d","role":"section-title"},{"id":"b-86a20a34b5aac7ffdbf8de1a","url":"#b-86a20a34b5aac7ffdbf8de1a","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-ad98c14db657ee76236d99c5","type":"p","scope":"block-d3888686b40d4fe0a93aac929dce690a","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-ad98c14db657ee76236d99c5","content":"**先回答：** 按预先写好的验证选择规则，这次应该选谁？scratch 获胜说明当前协议里预训练并未自动带来优势；它不能证明迁移普遍无效。短预算、相同学习率和这项特定二分类都限制结论。","sha256":"6e3c1e31f12d9894e36b5aed3ec68c9805c05930350d22402c986f73c3d236bc","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-0495306a95d840a5837582faa71e8a04","title":"3. 运行比较：用验证集选每组的停点","number":5},"sectionTitle":"3. 运行比较：用验证集选每组的停点","currentQuestion":"3. 运行比较：用验证集选每组的停点","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-ca04318e7e053ef604ea787c","nextBlock":"b-ddd872e37f88d5ad6d3631a4","prerequisites":[{"id":"b-8fbe6142d48e42cb1941e67d","url":"#b-8fbe6142d48e42cb1941e67d","role":"section-title"},{"id":"b-86a20a34b5aac7ffdbf8de1a","url":"#b-86a20a34b5aac7ffdbf8de1a","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-ddd872e37f88d5ad6d3631a4","type":"p","scope":"block-d3888686b40d4fe0a93aac929dce690a","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-ddd872e37f88d5ad6d3631a4","content":"下面会训练你的 4 个小模型，不覆盖既有源模型与课件响应。先保持默认协议核对，再进入最后的保留集评价；此时不能用保留结果回头挑更新范围。","sha256":"d69bbf3ce85d2d67714ac517b70f03313a350affa45dc8a434a1fc16464212d2","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-0495306a95d840a5837582faa71e8a04","title":"3. 运行比较：用验证集选每组的停点","number":5},"sectionTitle":"3. 运行比较：用验证集选每组的停点","currentQuestion":"3. 运行比较：用验证集选每组的停点","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-ad98c14db657ee76236d99c5","nextBlock":"b-6c0bf197d193218dc6a53131","prerequisites":[{"id":"b-8fbe6142d48e42cb1941e67d","url":"#b-8fbe6142d48e42cb1941e67d","role":"section-title"},{"id":"b-86a20a34b5aac7ffdbf8de1a","url":"#b-86a20a34b5aac7ffdbf8de1a","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-6c0bf197d193218dc6a53131","type":"pre","scope":"block-57c45842cea34b3f94d8cebb61d29d93","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-6c0bf197d193218dc6a53131","content":"```\n@torch.no_grad()\ndef evaluate_binary(model,xx,yy):\n    model.eval();scores=model(xx)\n    return {'ce':float(F.cross_entropy(scores,yy)), 'accuracy':float((scores.argmax(1)==yy).float().mean())}\ntorch.use_deterministic_algorithms(True)\ngenerator=torch.Generator().manual_seed(SEED+2)\norders=[torch.randperm(len(train_y),generator=generator) for _ in range(EPOCHS)]\nmodels={};records={}\nfor mode in MODES:\n    model=make_target_model(mode)\n    frozen_before={n:p.detach().clone() for n,p in model.named_parameters() if not p.requires_grad}\n    optimizer=torch.optim.Adam([p for p in model.parameters() if p.requires_grad],lr=LEARNING_RATE)\n    best_ce=float('inf');history=[];start=time.perf_counter()\n    for epoch,order in enumerate(orders,1):\n        model.train()\n        for ids in order.split(BATCH_SIZE):\n            optimizer.zero_grad();loss=F.cross_entropy(model(train_x[ids]),train_y[ids]);loss.backward();optimizer.step()\n        tr=evaluate_binary(model,train_x,train_y);va=evaluate_binary(model,val_x,val_y)\n        history.append({'epoch':epoch,'train_ce':tr['ce'],'val_ce':va['ce'],'val_accuracy':va['accuracy']})\n        if va['ce']<best_ce:\n            best_ce=va['ce'];best_state=copy.deepcopy(model.state_dict());selected=epoch\n    elapsed=time.perf_counter()-start\n    model.load_state_dict(best_state)\n    for name,param in model.named_parameters():\n        if name in frozen_before: assert torch.equal(param.detach(),frozen_before[name]),name\n    models[mode]=model\n    records[mode]={'selected_epoch':selected,'train':evaluate_binary(model,train_x,train_y),\n                   'validation':evaluate_binary(model,val_x,val_y),'seconds':elapsed,'history':history}\nfig,axes=plt.subplots(1,2,figsize=(10,3.5),sharey=True)\nfor mode,r in records.items():\n    axes[0].plot([v['epoch'] for v in r['history']],[v['train_ce'] for v in r['history']],label=mode)\n    axes[1].plot([v['epoch'] for v in r['history']],[v['val_ce'] for v in r['history']],label=mode)\n    chosen=next(v for v in r['history'] if v['epoch']==r['selected_epoch'])\n    axes[1].scatter([chosen['epoch']],[chosen['val_ce']],facecolors='none',edgecolors=axes[1].lines[-1].get_color(),s=75,zorder=3)\nymax=max(v[key] for r in records.values() for v in r['history'] for key in ('train_ce','val_ce'))\naxes[0].set_ylim(0,max(ymax*1.05,1e-8))\naxes[0].set_ylabel('Cross-entropy (same scale)')\naxes[0].set_title('training CE');axes[1].set_title('validation CE')\nfor ax in axes:ax.set_xlabel('epoch');ax.legend()\nplt.tight_layout();plt.show()\nprint(json.dumps({m:{k:v for k,v in r.items() if k!='history'} for m,r in records.items()},indent=2))\n\n```","sha256":"0d895fee1d544d1219f5704ce4ce47b623f9d946f397f4864637896fee477584","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-0495306a95d840a5837582faa71e8a04","title":"3. 运行比较：用验证集选每组的停点","number":5},"sectionTitle":"3. 运行比较：用验证集选每组的停点","currentQuestion":"3. 运行比较：用验证集选每组的停点","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-ddd872e37f88d5ad6d3631a4","nextBlock":null,"prerequisites":[{"id":"b-8fbe6142d48e42cb1941e67d","url":"#b-8fbe6142d48e42cb1941e67d","role":"section-title"},{"id":"b-86a20a34b5aac7ffdbf8de1a","url":"#b-86a20a34b5aac7ffdbf8de1a","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-2d20f4eaf76d8cd07ea0efa8","type":"h3","scope":"block-7b9a96ec2b424da28938ca221b03097d","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-2d20f4eaf76d8cd07ea0efa8","content":"### 4. 固定选择后，再看保留集","sha256":"5d65a30157b1630350682f10e6b268263c0812c39ffb61fa8da0ac2cae978bad","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-7b9a96ec2b424da28938ca221b03097d","title":"4. 固定选择后，再看保留集","number":6},"sectionTitle":"4. 固定选择后，再看保留集","currentQuestion":"4. 固定选择后，再看保留集","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-9da8b9711ba1f6dbc0725f5f","prerequisites":[{"id":"b-9da8b9711ba1f6dbc0725f5f","url":"#b-9da8b9711ba1f6dbc0725f5f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-9da8b9711ba1f6dbc0725f5f","type":"p","scope":"block-3371b976e9ee47ef8acd291849907a08","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-9da8b9711ba1f6dbc0725f5f","content":"先根据验证交叉熵选方案，再运行下格。在这个教学本中你可以看到所有候选的保留结果，但它们只作评价，不能回头选择学习率、轮数、位移或报告最漂亮的一次。","sha256":"ebcefced2fe65e545e3bf8745e0bdced48d541e7e6bc69123f5e7dd33add24c8","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-7b9a96ec2b424da28938ca221b03097d","title":"4. 固定选择后，再看保留集","number":6},"sectionTitle":"4. 固定选择后，再看保留集","currentQuestion":"4. 固定选择后，再看保留集","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-2d20f4eaf76d8cd07ea0efa8","nextBlock":"b-3d3b197708ecb39487f6df16","prerequisites":[{"id":"b-2d20f4eaf76d8cd07ea0efa8","url":"#b-2d20f4eaf76d8cd07ea0efa8","role":"section-title"}],"relatedBlocks":[]},{"id":"b-3d3b197708ecb39487f6df16","type":"p","scope":"block-3371b976e9ee47ef8acd291849907a08","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-3d3b197708ecb39487f6df16","content":"计时是当前环境的一次实测，不是稳定性能基准；同轮数也不等于同计算量。小数据、单种子和相近领域限制了结论，不能直接外推到叶片。","sha256":"bb2f4695f75c88ba952908a06f229ea62ed5a5d6f281ea33a47b9daee3c76975","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-7b9a96ec2b424da28938ca221b03097d","title":"4. 固定选择后，再看保留集","number":6},"sectionTitle":"4. 固定选择后，再看保留集","currentQuestion":"4. 固定选择后，再看保留集","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-9da8b9711ba1f6dbc0725f5f","nextBlock":"b-f4d92f67726b720fb2f2605a","prerequisites":[{"id":"b-2d20f4eaf76d8cd07ea0efa8","url":"#b-2d20f4eaf76d8cd07ea0efa8","role":"section-title"},{"id":"b-9da8b9711ba1f6dbc0725f5f","url":"#b-9da8b9711ba1f6dbc0725f5f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-f4d92f67726b720fb2f2605a","type":"pre","scope":"block-baa01d90e8534271a23cc4abac67a240","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-f4d92f67726b720fb2f2605a","content":"```\nselected_mode=min(records,key=lambda m:records[m]['validation']['ce'])\nfor mode,model in models.items():\n    records[mode]['heldout']=evaluate_binary(model,x[heldout_idx],y[heldout_idx])\nprint('只按验证 CE 选出的方案：',selected_mode)\nprint('mode | train acc | val acc | heldout acc | selected epoch')\nfor mode,r in records.items():\n    print(mode,round(r['train']['accuracy'],4),round(r['validation']['accuracy'],4),round(r['heldout']['accuracy'],4),r['selected_epoch'])\nLAB09_RESULT={'provenance':provenance,'protocol':{'train_n':TRAIN_LIMIT,'dx':DX,'epochs':EPOCHS,'batch_size':BATCH_SIZE,'learning_rate':LEARNING_RATE,'seed':SEED},\n              'selected_by_validation':selected_mode,'scopes':scope_table,'records':records}\nprint('LAB09_RESULT_JSON='+json.dumps(LAB09_RESULT,ensure_ascii=False))\n\n(OUT/'transfer-results.json').write_text(json.dumps(LAB09_RESULT,ensure_ascii=False,indent=2))\n# 当前单元无法确认宿主平台或是否使用全新进程；unknown 不等于 False。\nverification={'local_run':'unknown','cloud_run':'unknown','source_model_unchanged':hashlib.sha256(MODEL_PATH.read_bytes()).hexdigest()==model_sha256,'source_checkpoint_sha256':model_sha256,'sample_split_independent':True,'selected_by_validation':selected_mode,'scope':'complete student/teacher re-execution of 4 small transfer arms','torch':torch.__version__}\n(OUT/'verification.json').write_text(json.dumps(verification,indent=2))\n\n```","sha256":"424723804f6604ec98b4ffe0dcb621e40148726f4cc2a69abebec6ef22d82860","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-7b9a96ec2b424da28938ca221b03097d","title":"4. 固定选择后，再看保留集","number":6},"sectionTitle":"4. 固定选择后，再看保留集","currentQuestion":"4. 固定选择后，再看保留集","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-3d3b197708ecb39487f6df16","nextBlock":null,"prerequisites":[{"id":"b-2d20f4eaf76d8cd07ea0efa8","url":"#b-2d20f4eaf76d8cd07ea0efa8","role":"section-title"},{"id":"b-9da8b9711ba1f6dbc0725f5f","url":"#b-9da8b9711ba1f6dbc0725f5f","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-d1d2e95616c60c50a95df1e9","type":"h3","scope":"block-bb98304bd2584a18b41d35bf6edf6a61","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-d1d2e95616c60c50a95df1e9","content":"### 5. 回到叶片任务：哪些判断可以迁移，哪些不能？","sha256":"5286faba9a733afdf577a2f8139208e84c689669229b91f8d95342728a6e9b94","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","title":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","number":7},"sectionTitle":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","currentQuestion":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-a9bb29b33a8973c8eaebe768","prerequisites":[{"id":"b-a9bb29b33a8973c8eaebe768","url":"#b-a9bb29b33a8973c8eaebe768","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-a9bb29b33a8973c8eaebe768","type":"p","scope":"block-b9f56027bcce40909d958c3732474a97","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-a9bb29b33a8973c8eaebe768","content":"可以带走的是比较方法：同一个起点、明确新标签、独立划分、固定更新范围、验证选择、保留集评价。不能带走的是本数字实验的准确率或最佳方案。","sha256":"b0597e0846729128c6da1fbd8fdafd20d7d08024a0161e16a7519d196a66ccfd","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","title":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","number":7},"sectionTitle":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","currentQuestion":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-d1d2e95616c60c50a95df1e9","nextBlock":"b-9a1a8e6ffa2de70b95e323b4","prerequisites":[{"id":"b-d1d2e95616c60c50a95df1e9","url":"#b-d1d2e95616c60c50a95df1e9","role":"section-title"}],"relatedBlocks":[]},{"id":"b-9a1a8e6ffa2de70b95e323b4","type":"p","scope":"block-b9f56027bcce40909d958c3732474a97","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-9a1a8e6ffa2de70b95e323b4","content":"给叶片实验写一张下一步表：预训练来源及输入处理、按叶片/来源分组的划分、只训练新头的起点、解冻候选、评价指标、预算、会推翻当前选择的证据。保持结果栏为空，直到真实叶片数据和运行结果存在。","sha256":"df0fc7ce0dda76e7064435adc9e613d0e10bfd49fdbae31af21c591a705dfd40","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","title":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","number":7},"sectionTitle":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","currentQuestion":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-a9bb29b33a8973c8eaebe768","nextBlock":"b-3ae283ba9af62a9556b48a97","prerequisites":[{"id":"b-d1d2e95616c60c50a95df1e9","url":"#b-d1d2e95616c60c50a95df1e9","role":"section-title"},{"id":"b-a9bb29b33a8973c8eaebe768","url":"#b-a9bb29b33a8973c8eaebe768","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-3ae283ba9af62a9556b48a97","type":"p","scope":"block-b9f56027bcce40909d958c3732474a97","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-3ae283ba9af62a9556b48a97","content":"**继续一步**：把训练样本改为64，或把DX改为0，只改一项并重新运行第1节起的所有单元。先记预测，再比较训练/验证间距。第二轮之后保留集已被看过，探索结果应如实记录，正式报告需要重新预先固定评价协议。","sha256":"552a1b3eca044fb54d9567b52e522826e4a2a94e5e320721be50dc3ae901327c","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","title":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","number":7},"sectionTitle":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","currentQuestion":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-9a1a8e6ffa2de70b95e323b4","nextBlock":"b-94456f5b70e5afbbf737fa7d","prerequisites":[{"id":"b-d1d2e95616c60c50a95df1e9","url":"#b-d1d2e95616c60c50a95df1e9","role":"section-title"},{"id":"b-a9bb29b33a8973c8eaebe768","url":"#b-a9bb29b33a8973c8eaebe768","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-94456f5b70e5afbbf737fa7d","type":"p","scope":"block-b9f56027bcce40909d958c3732474a97","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-94456f5b70e5afbbf737fa7d","content":"来源：既有 LAB02 v2 检查点与官方 MNIST 训练文件，准确索引和文件哈希已内置；本页二分类比较不复用旧准确率作为新输出。[MNIST 来源](https://yann.lecun.com/exdb/mnist/) · [历史 L02-LAB 02 源模型与训练记录](https://codingai-lec02.pages.dev/course/lab02.html)。","sha256":"c4a00574ebad248e363d05363d2b3c2dc018d6f41426069cd8cfc6383a26099a","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","title":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","number":7},"sectionTitle":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","currentQuestion":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-3ae283ba9af62a9556b48a97","nextBlock":"b-ad9f8d48b184612274508bb9","prerequisites":[{"id":"b-d1d2e95616c60c50a95df1e9","url":"#b-d1d2e95616c60c50a95df1e9","role":"section-title"},{"id":"b-a9bb29b33a8973c8eaebe768","url":"#b-a9bb29b33a8973c8eaebe768","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-ad9f8d48b184612274508bb9","type":"p","scope":"block-b9f56027bcce40909d958c3732474a97","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-ad9f8d48b184612274508bb9","content":"**返回第三讲：**[主讲：三种更新范围](/#/l3-r2-p23/0) · [CLS 01 · 学习信号、表示与迁移](/course/c02-signals.html) · [统一导读](/course/guide.html)。","sha256":"c9d79598a1ef330a2421a96430640637426294bf84e35e15e3d16d9239075ab7","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","title":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","number":7},"sectionTitle":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","currentQuestion":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-94456f5b70e5afbbf737fa7d","nextBlock":"b-ad602e7b13bc7bceff4a2718","prerequisites":[{"id":"b-d1d2e95616c60c50a95df1e9","url":"#b-d1d2e95616c60c50a95df1e9","role":"section-title"},{"id":"b-a9bb29b33a8973c8eaebe768","url":"#b-a9bb29b33a8973c8eaebe768","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-ad602e7b13bc7bceff4a2718","type":"p","scope":"block-b9f56027bcce40909d958c3732474a97","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-ad602e7b13bc7bceff4a2718","content":"[旧第二讲 LAB 09 兼容入口](https://codingai-lec02.pages.dev/course/lab09.html)保留作历史兼容；当前学习路径以上面的第三讲入口为准。","sha256":"96a3da15a0b50af11eb0ad08fc9c2c6e0e667b75ad40e97ffd02f0cb13c3d452","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","title":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","number":7},"sectionTitle":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","currentQuestion":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-ad9f8d48b184612274508bb9","nextBlock":"b-c32210ea88a131fdfb41f5f1","prerequisites":[{"id":"b-d1d2e95616c60c50a95df1e9","url":"#b-d1d2e95616c60c50a95df1e9","role":"section-title"},{"id":"b-a9bb29b33a8973c8eaebe768","url":"#b-a9bb29b33a8973c8eaebe768","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-c32210ea88a131fdfb41f5f1","type":"p","scope":"block-59dbfb14a6064674bd55f9a7f44388fe","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-c32210ea88a131fdfb41f5f1","content":"**返回课程：**[第三讲导读](/course/guide.html) · [当前迁移主讲](/#/l3-r2-p23/0)。[旧第二讲 LAB 09 兼容入口](https://codingai-lec02.pages.dev/course/lab09.html)保留作历史兼容。感受野与响应观察已拆回第二讲参考，不要求先完成它才能运行迁移。","sha256":"d8a4bf3e975f6b911cd75779aa5377f17050a2cf1d1027fee5860082f93a63f3","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-bb98304bd2584a18b41d35bf6edf6a61","title":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","number":7},"sectionTitle":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","currentQuestion":"5. 回到叶片任务：哪些判断可以迁移，哪些不能？","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-ad602e7b13bc7bceff4a2718","nextBlock":null,"prerequisites":[{"id":"b-d1d2e95616c60c50a95df1e9","url":"#b-d1d2e95616c60c50a95df1e9","role":"section-title"},{"id":"b-a9bb29b33a8973c8eaebe768","url":"#b-a9bb29b33a8973c8eaebe768","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-f10a6d2ac409c19b475f134d","type":"h3","scope":"block-8a68f4cf433b45acbb62ee754ea3eb61","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-f10a6d2ac409c19b475f134d","content":"### 6 · 选读：参数、梯度记录和模块状态","sha256":"21bb6e9d24de7d819fd0060213e2fee00ec3461ad2a684a585cf52fa3a0bc7fa","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","title":"6 · 选读：参数、梯度记录和模块状态","number":8},"sectionTitle":"6 · 选读：参数、梯度记录和模块状态","currentQuestion":"6 · 选读：参数、梯度记录和模块状态","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":null,"nextBlock":"b-8c36c117383c038ba26f9c73","prerequisites":[{"id":"b-8c36c117383c038ba26f9c73","url":"#b-8c36c117383c038ba26f9c73","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-8c36c117383c038ba26f9c73","type":"p","scope":"block-0ef258c369294c3790069c7ff756bc1f","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-8c36c117383c038ba26f9c73","content":"迁移可以只训练新分类头、解冻后部，或整体微调。应固定数据划分与评价指标，使用相同预算或明确记录预算差异；训练集很小时，也要把冻结表示的简单读出作为基线。","sha256":"743f7ff001688d3fd8f001607314747499c29a834f3a8b57ba4de33a50791ae0","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","title":"6 · 选读：参数、梯度记录和模块状态","number":8},"sectionTitle":"6 · 选读：参数、梯度记录和模块状态","currentQuestion":"6 · 选读：参数、梯度记录和模块状态","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-f10a6d2ac409c19b475f134d","nextBlock":"b-dbfa4df0ae12ee79b48efb40","prerequisites":[{"id":"b-f10a6d2ac409c19b475f134d","url":"#b-f10a6d2ac409c19b475f134d","role":"section-title"}],"relatedBlocks":[]},{"id":"b-dbfa4df0ae12ee79b48efb40","type":"p","scope":"block-0ef258c369294c3790069c7ff756bc1f","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-dbfa4df0ae12ee79b48efb40","content":"三个开关控制不同对象：","sha256":"79eaaaffdd9882253c3916d1ebaac1d9ea507abf90c5b0ba17bb95322c3f0d2b","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","title":"6 · 选读：参数、梯度记录和模块状态","number":8},"sectionTitle":"6 · 选读：参数、梯度记录和模块状态","currentQuestion":"6 · 选读：参数、梯度记录和模块状态","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-8c36c117383c038ba26f9c73","nextBlock":"b-32fe794b46b0500c14a666d6","prerequisites":[{"id":"b-f10a6d2ac409c19b475f134d","url":"#b-f10a6d2ac409c19b475f134d","role":"section-title"},{"id":"b-8c36c117383c038ba26f9c73","url":"#b-8c36c117383c038ba26f9c73","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-32fe794b46b0500c14a666d6","type":"table","scope":"block-0ef258c369294c3790069c7ff756bc1f","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-32fe794b46b0500c14a666d6","content":"| 开关 | 改变什么 | 不自动保证什么 |\n| --- | --- | --- |\n| model.eval() | BN、Dropout 等模块的模式 | 不关闭自动求导 |\n| torch.no_grad() | 作用域内的梯度图记录 | 不切换 BN/Dropout 模式 |\n| parameter.requiresgrad(False) | 指定参数是否需要梯度 | 不冻结 BN 的运行统计 |","sha256":"53726d629b4dafcabac379f9dd5cf5f4b89b047d69a58976455e58267facdd6e","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","title":"6 · 选读：参数、梯度记录和模块状态","number":8},"sectionTitle":"6 · 选读：参数、梯度记录和模块状态","currentQuestion":"6 · 选读：参数、梯度记录和模块状态","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"table":{"headers":["开关","改变什么","不自动保证什么"],"rows":[["开关","改变什么","不自动保证什么"],["model.eval()","BN、Dropout 等模块的模式","不关闭自动求导"],["torch.no_grad()","作用域内的梯度图记录","不切换 BN/Dropout 模式"],["parameter.requiresgrad(False)","指定参数是否需要梯度","不冻结 BN 的运行统计"]]},"previousBlock":"b-dbfa4df0ae12ee79b48efb40","nextBlock":"b-e38d3282b6de47f653964293","prerequisites":[{"id":"b-f10a6d2ac409c19b475f134d","url":"#b-f10a6d2ac409c19b475f134d","role":"section-title"},{"id":"b-8c36c117383c038ba26f9c73","url":"#b-8c36c117383c038ba26f9c73","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-e38d3282b6de47f653964293","type":"p","scope":"block-0ef258c369294c3790069c7ff756bc1f","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-e38d3282b6de47f653964293","content":"例如冻结 backbone 权重后，若它仍处于 train 模式，BN buffers 可能继续变化，Dropout 也可能继续随机屏蔽。普通预测常同时使用 eval 与 no_grad；输入梯度可视化可能需要 eval，但必须保留输入的梯度记录。应按任务组合开关，而非背一个通用模板。","sha256":"1fb03d6956b1cd8ef67bdc56700240174a115de5a8510417f236f504b2f0f94b","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","title":"6 · 选读：参数、梯度记录和模块状态","number":8},"sectionTitle":"6 · 选读：参数、梯度记录和模块状态","currentQuestion":"6 · 选读：参数、梯度记录和模块状态","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-32fe794b46b0500c14a666d6","nextBlock":"b-025f83bba3b7a75052d834fe","prerequisites":[{"id":"b-f10a6d2ac409c19b475f134d","url":"#b-f10a6d2ac409c19b475f134d","role":"section-title"},{"id":"b-8c36c117383c038ba26f9c73","url":"#b-8c36c117383c038ba26f9c73","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-025f83bba3b7a75052d834fe","type":"p","scope":"block-0ef258c369294c3790069c7ff756bc1f","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-025f83bba3b7a75052d834fe","content":"本节扩展了课后 BN 状态知识，主讲结课不以掌握这些 API 差异作为所有学生的通过条件。","sha256":"3e99597f362c701010faa3a4aad3ea21d721a31a6326ee28c2a294cf5f79e0af","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","title":"6 · 选读：参数、梯度记录和模块状态","number":8},"sectionTitle":"6 · 选读：参数、梯度记录和模块状态","currentQuestion":"6 · 选读：参数、梯度记录和模块状态","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-e38d3282b6de47f653964293","nextBlock":"b-9ee8b053fc9b1b6b94863407","prerequisites":[{"id":"b-f10a6d2ac409c19b475f134d","url":"#b-f10a6d2ac409c19b475f134d","role":"section-title"},{"id":"b-8c36c117383c038ba26f9c73","url":"#b-8c36c117383c038ba26f9c73","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-9ee8b053fc9b1b6b94863407","type":"p","scope":"block-0ef258c369294c3790069c7ff756bc1f","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-9ee8b053fc9b1b6b94863407","content":"**先判断**：为了画输入敏感性图，先调用 eval() 是否会导致无法求输入梯度？","sha256":"029cb931c3edb8821ff9b7edf711311a13733d22e8595f026b8fb2d357d57806","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","title":"6 · 选读：参数、梯度记录和模块状态","number":8},"sectionTitle":"6 · 选读：参数、梯度记录和模块状态","currentQuestion":"6 · 选读：参数、梯度记录和模块状态","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-025f83bba3b7a75052d834fe","nextBlock":"b-17aaaed3497664782597be70","prerequisites":[{"id":"b-f10a6d2ac409c19b475f134d","url":"#b-f10a6d2ac409c19b475f134d","role":"section-title"},{"id":"b-8c36c117383c038ba26f9c73","url":"#b-8c36c117383c038ba26f9c73","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-17aaaed3497664782597be70","type":"p","scope":"block-0ef258c369294c3790069c7ff756bc1f","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-17aaaed3497664782597be70","content":"**核对提示**：不会。eval 只切换特定模块模式；只要记录计算图并让输入 requiresgrad=True，仍可求梯度。若放在 nograd 作用域内，才会丢失需要的记录。","sha256":"dd03c7cb5256b2c557373e639baac15bbd9be86a0a2468ba58e264c937a0f071","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","title":"6 · 选读：参数、梯度记录和模块状态","number":8},"sectionTitle":"6 · 选读：参数、梯度记录和模块状态","currentQuestion":"6 · 选读：参数、梯度记录和模块状态","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-9ee8b053fc9b1b6b94863407","nextBlock":"b-ccbf4ff54af11c3ca79b71d1","prerequisites":[{"id":"b-f10a6d2ac409c19b475f134d","url":"#b-f10a6d2ac409c19b475f134d","role":"section-title"},{"id":"b-8c36c117383c038ba26f9c73","url":"#b-8c36c117383c038ba26f9c73","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-ccbf4ff54af11c3ca79b71d1","type":"p","scope":"block-0ef258c369294c3790069c7ff756bc1f","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-ccbf4ff54af11c3ca79b71d1","content":"**来源与继续阅读**","sha256":"34bff16da9169f6f9707284e6832f14d88f007b3a1f1a7410c4c43d463d13ac3","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","title":"6 · 选读：参数、梯度记录和模块状态","number":8},"sectionTitle":"6 · 选读：参数、梯度记录和模块状态","currentQuestion":"6 · 选读：参数、梯度记录和模块状态","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-17aaaed3497664782597be70","nextBlock":"b-98acfa628f3e84752a6d2fe1","prerequisites":[{"id":"b-f10a6d2ac409c19b475f134d","url":"#b-f10a6d2ac409c19b475f134d","role":"section-title"},{"id":"b-8c36c117383c038ba26f9c73","url":"#b-8c36c117383c038ba26f9c73","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-98acfa628f3e84752a6d2fe1","type":"ul","scope":"block-0ef258c369294c3790069c7ff756bc1f","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-98acfa628f3e84752a6d2fe1","content":"- [PyTorch · Autograd mechanics and evaluation mode](https://docs.pytorch.org/docs/stable/notes/autograd.html)\n\n- [PyTorch · BatchNorm2d API](https://docs.pytorch.org/docs/stable/generated/torch.nn.BatchNorm2d.html)\n\n- [D2L 5.6 · Dropout](https://d2l.ai/chapter_multilayer-perceptrons/dropout.html)","sha256":"e6a3867ce2abb1ebb362d6010a21de0a15396b7f6d5397d6e758f541f9783b5f","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","title":"6 · 选读：参数、梯度记录和模块状态","number":8},"sectionTitle":"6 · 选读：参数、梯度记录和模块状态","currentQuestion":"6 · 选读：参数、梯度记录和模块状态","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-ccbf4ff54af11c3ca79b71d1","nextBlock":"b-47ad384b31d4a9fa49e7fc03","prerequisites":[{"id":"b-f10a6d2ac409c19b475f134d","url":"#b-f10a6d2ac409c19b475f134d","role":"section-title"},{"id":"b-8c36c117383c038ba26f9c73","url":"#b-8c36c117383c038ba26f9c73","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-47ad384b31d4a9fa49e7fc03","type":"li","scope":"block-0ef258c369294c3790069c7ff756bc1f","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-47ad384b31d4a9fa49e7fc03","content":"- [PyTorch · Autograd mechanics and evaluation mode](https://docs.pytorch.org/docs/stable/notes/autograd.html)","sha256":"eb6100ae069e0f2e80cad437e18f1b80d5fd52c209b2ebc6776b351784ef84db","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","title":"6 · 选读：参数、梯度记录和模块状态","number":8},"sectionTitle":"6 · 选读：参数、梯度记录和模块状态","currentQuestion":"6 · 选读：参数、梯度记录和模块状态","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-98acfa628f3e84752a6d2fe1","nextBlock":"b-08ff83364b2017f8a6d3265d","prerequisites":[{"id":"b-f10a6d2ac409c19b475f134d","url":"#b-f10a6d2ac409c19b475f134d","role":"section-title"},{"id":"b-8c36c117383c038ba26f9c73","url":"#b-8c36c117383c038ba26f9c73","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-08ff83364b2017f8a6d3265d","type":"li","scope":"block-0ef258c369294c3790069c7ff756bc1f","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-08ff83364b2017f8a6d3265d","content":"- [PyTorch · BatchNorm2d API](https://docs.pytorch.org/docs/stable/generated/torch.nn.BatchNorm2d.html)","sha256":"cbe6b81393f1f3d96060c19c28c6a4d2b85c3b2cb3bf2802e095a77295f423c3","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","title":"6 · 选读：参数、梯度记录和模块状态","number":8},"sectionTitle":"6 · 选读：参数、梯度记录和模块状态","currentQuestion":"6 · 选读：参数、梯度记录和模块状态","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-47ad384b31d4a9fa49e7fc03","nextBlock":"b-1218c97f5b9f1f6fdf4d345d","prerequisites":[{"id":"b-f10a6d2ac409c19b475f134d","url":"#b-f10a6d2ac409c19b475f134d","role":"section-title"},{"id":"b-8c36c117383c038ba26f9c73","url":"#b-8c36c117383c038ba26f9c73","role":"problem-context"}],"relatedBlocks":[]},{"id":"b-1218c97f5b9f1f6fdf4d345d","type":"li","scope":"block-0ef258c369294c3790069c7ff756bc1f","url":"https://codingai-lec03.pages.dev/course/lab09-transfer.html#b-1218c97f5b9f1f6fdf4d345d","content":"- [D2L 5.6 · Dropout](https://d2l.ai/chapter_multilayer-perceptrons/dropout.html)","sha256":"051a9ece573f3d246724abacb6eec739dc0d36eff118c8253281e204b5df3d18","chapter":{"id":"course","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"unit":{"id":"lab09-transfer","title":"LAB 02 · 参数迁移：冻结、局部与全量微调"},"page":{"id":"reading-block-8a68f4cf433b45acbb62ee754ea3eb61","title":"6 · 选读：参数、梯度记录和模块状态","number":8},"sectionTitle":"6 · 选读：参数、梯度记录和模块状态","currentQuestion":"6 · 选读：参数、梯度记录和模块状态","sourceSlides":[],"knowledgeBlock":null,"formulas":[],"previousBlock":"b-08ff83364b2017f8a6d3265d","nextBlock":null,"prerequisites":[{"id":"b-f10a6d2ac409c19b475f134d","url":"#b-f10a6d2ac409c19b475f134d","role":"section-title"},{"id":"b-8c36c117383c038ba26f9c73","url":"#b-8c36c117383c038ba26f9c73","role":"problem-context"}],"relatedBlocks":[]}]}
