diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Antigua b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Antigua new file mode 100644 index 0000000000000000000000000000000000000000..a662a57137b69e8ba445e899566222cdd422a764 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Antigua differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Bahia_Banderas b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Bahia_Banderas new file mode 100644 index 0000000000000000000000000000000000000000..3a493e3d5a93f08201c41cb25616015963254589 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Bahia_Banderas differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Belem b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Belem new file mode 100644 index 0000000000000000000000000000000000000000..0ae1202682c94ee52f74a795099f6a11d34e0d1e Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Belem differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Belize b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Belize new file mode 100644 index 0000000000000000000000000000000000000000..e6f5dfa6a8d82523e8cb12f17cf73560bc09a383 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Belize differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Boa_Vista b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Boa_Vista new file mode 100644 index 0000000000000000000000000000000000000000..08d518b151425f85458727fbf69f6e601f12be86 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Boa_Vista differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Cambridge_Bay b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Cambridge_Bay new file mode 100644 index 0000000000000000000000000000000000000000..7e58a203c6bdc9045092f879f8f58aa960084cad Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Cambridge_Bay differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Campo_Grande b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Campo_Grande new file mode 100644 index 0000000000000000000000000000000000000000..53b3330fac2bd64c02d8dc171c722ec491bea41d Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Campo_Grande differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Caracas b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Caracas new file mode 100644 index 0000000000000000000000000000000000000000..3f3ebc9c410fe2a33ad26a5d02bb99b9503e1f72 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Caracas differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Chicago b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Chicago new file mode 100644 index 0000000000000000000000000000000000000000..c6981a06b1d9c26f447518efe265a6454726eae7 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Chicago differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Coral_Harbour b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Coral_Harbour new file mode 100644 index 0000000000000000000000000000000000000000..9964b9a33452f4b636f43703b7cdec4891cbda5f Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Coral_Harbour differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Cordoba b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Cordoba new file mode 100644 index 0000000000000000000000000000000000000000..2ad6ea5db204d599266412558f5a1fae076fc41a Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Cordoba differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Creston b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Creston new file mode 100644 index 0000000000000000000000000000000000000000..ab37e845566aa95659b7b85be0051d0c67a7e53a Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Creston differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Dawson b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Dawson new file mode 100644 index 0000000000000000000000000000000000000000..343b63227d2185863cd720bf449de000bbc794d0 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Dawson differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Denver b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Denver new file mode 100644 index 0000000000000000000000000000000000000000..abb2b974a47eb3e5c8b4f5d4370baf4898b239ab Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Denver differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Detroit b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Detroit new file mode 100644 index 0000000000000000000000000000000000000000..e104faa46545ee873295cde34e1d46bccad8647c Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Detroit differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Edmonton b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Edmonton new file mode 100644 index 0000000000000000000000000000000000000000..cd78a6f8be1dd55ac5afd25bbae39bd5706e42d1 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Edmonton differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Fort_Nelson b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Fort_Nelson new file mode 100644 index 0000000000000000000000000000000000000000..5a0b7f1ca032be1adf8ba91f863e727c5ec6a026 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Fort_Nelson differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Goose_Bay b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Goose_Bay new file mode 100644 index 0000000000000000000000000000000000000000..a3f299079aebb8524bf77e7f92e0a7e6d0a7b6fb Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Goose_Bay differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Grenada b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Grenada new file mode 100644 index 0000000000000000000000000000000000000000..a662a57137b69e8ba445e899566222cdd422a764 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Grenada differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Guayaquil b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Guayaquil new file mode 100644 index 0000000000000000000000000000000000000000..40831be11e0ab028ada80cecf5fdc0e2a233ee17 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Guayaquil differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Guyana b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Guyana new file mode 100644 index 0000000000000000000000000000000000000000..9b7036723053b8e8e3888b0497528fe714b5b735 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Guyana differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Hermosillo b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Hermosillo new file mode 100644 index 0000000000000000000000000000000000000000..441fe3f2dd133fd081247131d860bac327107499 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Hermosillo differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Indiana/Indianapolis b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Indiana/Indianapolis new file mode 100644 index 0000000000000000000000000000000000000000..a84b6e99671f7305d1c459956e16a4dd772fc60e Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Indiana/Indianapolis differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Indiana/Vincennes b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Indiana/Vincennes new file mode 100644 index 0000000000000000000000000000000000000000..35a24133446b9ee1e8f8a7931519d93517130315 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Indiana/Vincennes differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Indiana/Winamac b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Indiana/Winamac new file mode 100644 index 0000000000000000000000000000000000000000..6d4e19377e9f70c3782daa223753c640c60ab1eb Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Indiana/Winamac differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Indianapolis b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Indianapolis new file mode 100644 index 0000000000000000000000000000000000000000..a84b6e99671f7305d1c459956e16a4dd772fc60e Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Indianapolis differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Inuvik b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Inuvik new file mode 100644 index 0000000000000000000000000000000000000000..04c2df456ff0f879a419331dc3e9f4d4f68f0ecd Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Inuvik differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Iqaluit b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Iqaluit new file mode 100644 index 0000000000000000000000000000000000000000..0b47b9032f11d4ea7dd6ac51aa329f7a98253638 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Iqaluit differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Jujuy b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Jujuy new file mode 100644 index 0000000000000000000000000000000000000000..7ca0b46f680b80780981aab0699e64dd04070fe7 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Jujuy differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Kentucky/Louisville b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Kentucky/Louisville new file mode 100644 index 0000000000000000000000000000000000000000..3a335b37165d2b3d6a09a1716cb158e272087c9f Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Kentucky/Louisville differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Kentucky/Monticello b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Kentucky/Monticello new file mode 100644 index 0000000000000000000000000000000000000000..576f16bb2b21a7e0871a7222241ad65e533bb93a Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Kentucky/Monticello differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Los_Angeles b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Los_Angeles new file mode 100644 index 0000000000000000000000000000000000000000..610e7af5fc13d9784de30d272c7c39d7938873a0 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Los_Angeles differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Maceio b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Maceio new file mode 100644 index 0000000000000000000000000000000000000000..437a47310ec174736b0efbbe9e7e9a8cc26c150c Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Maceio differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Managua b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Managua new file mode 100644 index 0000000000000000000000000000000000000000..e0242bff6e5df45de8b235abb4a8405fbb8ba6a6 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Managua differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Martinique b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Martinique new file mode 100644 index 0000000000000000000000000000000000000000..8df43dcf1c9f63d3ea9f056f062ea97e5c7c0b57 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Martinique differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Mazatlan b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Mazatlan new file mode 100644 index 0000000000000000000000000000000000000000..386616a59cdb2a21f1f24a6c72526bce0360cd24 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Mazatlan differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Mendoza b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Mendoza new file mode 100644 index 0000000000000000000000000000000000000000..3232c80e2003489921578f7acbabc73fb9148205 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Mendoza differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Menominee b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Menominee new file mode 100644 index 0000000000000000000000000000000000000000..314613866de53e1457f6cbf2fb617be7e4955edf Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Menominee differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Metlakatla b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Metlakatla new file mode 100644 index 0000000000000000000000000000000000000000..1e94be3d552ea0d6e29824469866c2a51a187be9 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Metlakatla differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Miquelon b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Miquelon new file mode 100644 index 0000000000000000000000000000000000000000..f780ea990ff22675b5cc4e4dbe2c8690ae4e41b4 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Miquelon differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Moncton b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Moncton new file mode 100644 index 0000000000000000000000000000000000000000..9df8d0f2ec9fc8f1974d83cdd8155c79340007ed Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Moncton differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Montserrat b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Montserrat new file mode 100644 index 0000000000000000000000000000000000000000..a662a57137b69e8ba445e899566222cdd422a764 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Montserrat differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Nipigon b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Nipigon new file mode 100644 index 0000000000000000000000000000000000000000..170137333f9f6dba10ac3ad7f32876aaf518c4fd Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Nipigon differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Nome b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Nome new file mode 100644 index 0000000000000000000000000000000000000000..10998df3bbe67aa8a02602301d10ec2b2c33006b Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Nome differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Nuuk b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Nuuk new file mode 100644 index 0000000000000000000000000000000000000000..29958cf12a9df7cf775e3337b4894e4cf4b82f58 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Nuuk differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Pangnirtung b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Pangnirtung new file mode 100644 index 0000000000000000000000000000000000000000..0b47b9032f11d4ea7dd6ac51aa329f7a98253638 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Pangnirtung differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Paramaribo b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Paramaribo new file mode 100644 index 0000000000000000000000000000000000000000..f1b82b4f9a546fd067cf043ba5d35da6fbe41fbe Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Paramaribo differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Phoenix b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Phoenix new file mode 100644 index 0000000000000000000000000000000000000000..ab37e845566aa95659b7b85be0051d0c67a7e53a Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Phoenix differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Port_of_Spain b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Port_of_Spain new file mode 100644 index 0000000000000000000000000000000000000000..a662a57137b69e8ba445e899566222cdd422a764 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Port_of_Spain differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Porto_Velho b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Porto_Velho new file mode 100644 index 0000000000000000000000000000000000000000..e00398602c634e6f1e9c0bc0e12b064f343ffe0c Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Porto_Velho differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Regina b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Regina new file mode 100644 index 0000000000000000000000000000000000000000..20c9c84df491e4072ec4c5d2c931a7433d9fd394 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Regina differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Santa_Isabel b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Santa_Isabel new file mode 100644 index 0000000000000000000000000000000000000000..0fe73912cacab6c8aabef4f4264d1710825888e7 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Santa_Isabel differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Santarem b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Santarem new file mode 100644 index 0000000000000000000000000000000000000000..001638c2f2a964eb2cc75660f66a1bcc447d7a57 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Santarem differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Santo_Domingo b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Santo_Domingo new file mode 100644 index 0000000000000000000000000000000000000000..4fe36fd4c11f998ba3f626c5e23d97bd82d12791 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Santo_Domingo differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Tegucigalpa b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Tegucigalpa new file mode 100644 index 0000000000000000000000000000000000000000..2adacb2e500e2f9621b2debc1756d308747b67f6 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Tegucigalpa differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Thule b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Thule new file mode 100644 index 0000000000000000000000000000000000000000..6f802f1c2acf9cc73481ae86c9e099fcfc28cf25 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Thule differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Tortola b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Tortola new file mode 100644 index 0000000000000000000000000000000000000000..a662a57137b69e8ba445e899566222cdd422a764 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Tortola differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Vancouver b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Vancouver new file mode 100644 index 0000000000000000000000000000000000000000..bb60cbced30763c08b6cf73554c8d6651ff387d0 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Vancouver differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Virgin b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Virgin new file mode 100644 index 0000000000000000000000000000000000000000..a662a57137b69e8ba445e899566222cdd422a764 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Virgin differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Winnipeg b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Winnipeg new file mode 100644 index 0000000000000000000000000000000000000000..ac40299f6b27043e8f2454ac594b0ec184c1a237 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/America/Winnipeg differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/Pacific/Auckland b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/Pacific/Auckland new file mode 100644 index 0000000000000000000000000000000000000000..6575fdce31183d8238b18f2f30ab5b9227c7071c Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/Pacific/Auckland differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/Pacific/Galapagos b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/Pacific/Galapagos new file mode 100644 index 0000000000000000000000000000000000000000..40051ddf63a32d79e5233b916e3911d6dc3ef759 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/Pacific/Galapagos differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/Pacific/Kanton b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/Pacific/Kanton new file mode 100644 index 0000000000000000000000000000000000000000..b1c4b0734483033722c28c8b2884ac9dddd2ab45 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/Pacific/Kanton differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/Pacific/Midway b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/Pacific/Midway new file mode 100644 index 0000000000000000000000000000000000000000..cb56709a77dedb471150f4907771bf38f1879ba4 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/Pacific/Midway differ diff --git a/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/Pacific/Wallis b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/Pacific/Wallis new file mode 100644 index 0000000000000000000000000000000000000000..47661d40a4188eb39e8d52e5af8ab23ef7f23766 Binary files /dev/null and b/deepseek/lib/python3.10/site-packages/pytz/zoneinfo/Pacific/Wallis differ diff --git a/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/__pycache__/__init__.cpython-310.pyc b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..0cf6a375b35067feed62da8c397e752b6aca8bd0 Binary files /dev/null and b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/__pycache__/__init__.cpython-310.pyc differ diff --git a/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/modules/__pycache__/__init__.cpython-310.pyc b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/modules/__pycache__/__init__.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..9dd8456c2d831fd11ac56ab9aa0c0862a2c088d0 Binary files /dev/null and b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/modules/__pycache__/__init__.cpython-310.pyc differ diff --git a/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/__init__.py b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..3d79bdbfe83209f18b17cc8c7b245f322871d6c0 --- /dev/null +++ b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/__init__.py @@ -0,0 +1 @@ +from .modules import * # noqa: F403 diff --git a/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/__init__.py b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/__init__.py new file mode 100644 index 0000000000000000000000000000000000000000..f44820c637e86c82c0f5d02919fa1c66803f21ac --- /dev/null +++ b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/__init__.py @@ -0,0 +1,31 @@ +from .linear_relu import LinearReLU +from .linear_fused import LinearBn1d +from .conv_fused import ( + ConvBn1d, + ConvBn2d, + ConvBn3d, + ConvBnReLU1d, + ConvBnReLU2d, + ConvBnReLU3d, + ConvReLU1d, + ConvReLU2d, + ConvReLU3d, + update_bn_stats, + freeze_bn_stats, +) + +__all__ = [ + "LinearReLU", + "LinearBn1d", + "ConvReLU1d", + "ConvReLU2d", + "ConvReLU3d", + "ConvBn1d", + "ConvBn2d", + "ConvBn3d", + "ConvBnReLU1d", + "ConvBnReLU2d", + "ConvBnReLU3d", + "update_bn_stats", + "freeze_bn_stats", +] diff --git a/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/__pycache__/conv_fused.cpython-310.pyc b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/__pycache__/conv_fused.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..655cd4a31f3665669fc74d5cc23d0dc92e843c3b Binary files /dev/null and b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/__pycache__/conv_fused.cpython-310.pyc differ diff --git a/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/__pycache__/linear_fused.cpython-310.pyc b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/__pycache__/linear_fused.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..34eec1f51df6dd65909e414d71310a25a6e992e2 Binary files /dev/null and b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/__pycache__/linear_fused.cpython-310.pyc differ diff --git a/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/__pycache__/linear_relu.cpython-310.pyc b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/__pycache__/linear_relu.cpython-310.pyc new file mode 100644 index 0000000000000000000000000000000000000000..7ded096ce1cb32960cd674e7cae467a62b43356a Binary files /dev/null and b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/__pycache__/linear_relu.cpython-310.pyc differ diff --git a/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/conv_fused.py b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/conv_fused.py new file mode 100644 index 0000000000000000000000000000000000000000..b0af9e669876f073ea597be50d60da014c3e8682 --- /dev/null +++ b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/conv_fused.py @@ -0,0 +1,824 @@ +import math +import torch +import torch.nn as nn +import torch.ao.nn.intrinsic as nni +import torch.ao.nn.qat as nnqat +import torch.nn.functional as F +from torch.nn import init +from torch.nn.utils import fuse_conv_bn_weights +from torch.nn.modules.utils import _single, _pair, _triple +from torch.nn.parameter import Parameter +from typing import TypeVar + +__all__ = ['ConvBn1d', 'ConvBnReLU1d', 'ConvReLU1d', 'ConvBn2d', 'ConvBnReLU2d', 'ConvReLU2d', 'ConvBn3d', + 'ConvBnReLU3d', 'ConvReLU3d', 'update_bn_stats', 'freeze_bn_stats'] +_BN_CLASS_MAP = { + 1: nn.BatchNorm1d, + 2: nn.BatchNorm2d, + 3: nn.BatchNorm3d, +} + + +MOD = TypeVar('MOD', bound=nn.modules.conv._ConvNd) + + +class _ConvBnNd(nn.modules.conv._ConvNd, nni._FusedModule): + + _version = 2 + _FLOAT_MODULE = MOD + + def __init__(self, + # ConvNd args + in_channels, out_channels, kernel_size, stride, + padding, dilation, transposed, output_padding, + groups, + bias, + padding_mode, + # BatchNormNd args + # num_features: out_channels + eps=1e-05, momentum=0.1, + # affine: True + # track_running_stats: True + # Args for this module + freeze_bn=False, + qconfig=None, + dim=2): + nn.modules.conv._ConvNd.__init__(self, in_channels, out_channels, kernel_size, + stride, padding, dilation, transposed, + output_padding, groups, False, padding_mode) + assert qconfig, 'qconfig must be provided for QAT module' + self.qconfig = qconfig + self.freeze_bn = freeze_bn if self.training else True + self.bn = _BN_CLASS_MAP[dim](out_channels, eps, momentum, True, True) + self.weight_fake_quant = self.qconfig.weight() + if bias: + self.bias = Parameter(torch.empty(out_channels)) + else: + self.register_parameter('bias', None) + self.reset_bn_parameters() + + # this needs to be called after reset_bn_parameters, + # as they modify the same state + if self.training: + if freeze_bn: + self.freeze_bn_stats() + else: + self.update_bn_stats() + else: + self.freeze_bn_stats() + + self._enable_slow_path_for_better_numerical_stability = False + + def reset_running_stats(self): + self.bn.reset_running_stats() + + def reset_bn_parameters(self): + self.bn.reset_running_stats() + init.uniform_(self.bn.weight) + init.zeros_(self.bn.bias) + # note: below is actully for conv, not BN + if self.bias is not None: + fan_in, _ = init._calculate_fan_in_and_fan_out(self.weight) + bound = 1 / math.sqrt(fan_in) + init.uniform_(self.bias, -bound, bound) + + def reset_parameters(self): + super().reset_parameters() + + def update_bn_stats(self): + self.freeze_bn = False + self.bn.training = True + return self + + def freeze_bn_stats(self): + self.freeze_bn = True + self.bn.training = False + return self + + def _forward(self, input): + if self._enable_slow_path_for_better_numerical_stability: + return self._forward_slow(input) + return self._forward_approximate(input) + + def _forward_approximate(self, input): + """Approximated method to fuse conv and bn. It requires only one forward pass. + conv_orig = conv / scale_factor where scale_factor = bn.weight / running_std + """ + assert self.bn.running_var is not None + running_std = torch.sqrt(self.bn.running_var + self.bn.eps) + scale_factor = self.bn.weight / running_std + weight_shape = [1] * len(self.weight.shape) + weight_shape[0] = -1 + bias_shape = [1] * len(self.weight.shape) + bias_shape[1] = -1 + scaled_weight = self.weight_fake_quant(self.weight * scale_factor.reshape(weight_shape)) + # using zero bias here since the bias for original conv + # will be added later + if self.bias is not None: + zero_bias = torch.zeros_like(self.bias, dtype=input.dtype) + else: + zero_bias = torch.zeros(self.out_channels, device=scaled_weight.device, dtype=input.dtype) + conv = self._conv_forward(input, scaled_weight, zero_bias) + conv_orig = conv / scale_factor.reshape(bias_shape) + if self.bias is not None: + conv_orig = conv_orig + self.bias.reshape(bias_shape) + conv = self.bn(conv_orig) + return conv + + def _forward_slow(self, input): + """ + A more accurate but slow method to compute conv bn fusion, following https://arxiv.org/pdf/1806.08342.pdf + It requires two forward passes but handles the case bn.weight == 0 + + Conv: Y = WX + B_c + Conv without bias: Y0 = WX = Y - B_c, Y = Y0 + B_c + + Batch statistics: + mean_Y = Y.mean() + = Y0.mean() + B_c + var_Y = (Y - mean_Y)^2.mean() + = (Y0 - Y0.mean())^2.mean() + BN (r: bn.weight, beta: bn.bias): + Z = r * (Y - mean_Y) / sqrt(var_Y + eps) + beta + = r * (Y0 - Y0.mean()) / sqrt(var_Y + eps) + beta + + Fused Conv BN training (std_Y = sqrt(var_Y + eps)): + Z = (r * W / std_Y) * X + r * (B_c - mean_Y) / std_Y + beta + = (r * W / std_Y) * X - r * Y0.mean() / std_Y + beta + + Fused Conv BN inference (running_std = sqrt(running_var + eps)): + Z = (r * W / running_std) * X - r * (running_mean - B_c) / running_std + beta + + QAT with fused conv bn: + Z_train = fake_quant(r * W / running_std) * X * (running_std / std_Y) - r * Y0.mean() / std_Y + beta + = conv(X, fake_quant(r * W / running_std)) * (running_std / std_Y) - r * Y0.mean() / std_Y + beta + Z_inference = conv(X, fake_quant(r * W / running_std)) - r * (running_mean - B_c) / running_std + beta + """ + + assert self.bn.running_var is not None + assert self.bn.running_mean is not None + + # using zero bias here since the bias for original conv + # will be added later + zero_bias = torch.zeros(self.out_channels, device=self.weight.device, dtype=input.dtype) + + weight_shape = [1] * len(self.weight.shape) + weight_shape[0] = -1 + bias_shape = [1] * len(self.weight.shape) + bias_shape[1] = -1 + + if self.bn.training: + # needed to compute batch mean/std + conv_out = self._conv_forward(input, self.weight, zero_bias) + # update bn statistics + with torch.no_grad(): + conv_out_bias = ( + conv_out if self.bias is None else conv_out + self.bias.reshape(bias_shape) + ) + self.bn(conv_out_bias) + + # fused conv + bn without bias using bn running statistics + running_std = torch.sqrt(self.bn.running_var + self.bn.eps) + scale_factor = self.bn.weight / running_std + scaled_weight = self.weight_fake_quant( + self.weight * scale_factor.reshape(weight_shape) + ) + # fused conv without bias for inference: (r * W / running_std) * X + conv_bn = self._conv_forward(input, scaled_weight, zero_bias) + + if self.bn.training: + avg_dims = [0] + list(range(2, len(self.weight.shape))) + batch_mean = conv_out.mean(avg_dims) + batch_var = torch.square(conv_out - batch_mean.reshape(bias_shape)).mean( + avg_dims + ) + batch_std = torch.sqrt(batch_var + self.bn.eps) + + # scale to use batch std in training mode + # conv(X, r * W / std_Y) = conv(X, r * W / running_std) * (running_std / std_Y) + unscale_factor = running_std / batch_std + conv_bn *= unscale_factor.reshape(bias_shape) + + fused_mean = batch_mean + fused_std = batch_std + else: + fused_mean = self.bn.running_mean - (self.bias if self.bias is not None else 0) + fused_std = running_std + + # fused bias = beta - r * mean / std + fused_bias = self.bn.bias - self.bn.weight * fused_mean / fused_std + conv_bn += fused_bias.reshape(bias_shape) + + # HACK to let conv bias particpiate in loss to avoid DDP error (parameters + # were not used in producing loss) + if self.bias is not None: + conv_bn += (self.bias - self.bias).reshape(bias_shape) + + return conv_bn + + def extra_repr(self): + # TODO(jerryzh): extend + return super().extra_repr() + + def forward(self, input): + return self._forward(input) + + def train(self, mode=True): + """ + Batchnorm's training behavior is using the self.training flag. Prevent + changing it if BN is frozen. This makes sure that calling `model.train()` + on a model with a frozen BN will behave properly. + """ + self.training = mode + if not self.freeze_bn: + for module in self.children(): + module.train(mode) + return self + + # ===== Serialization version history ===== + # + # Version 1/None + # self + # |--- weight : Tensor + # |--- bias : Tensor + # |--- gamma : Tensor + # |--- beta : Tensor + # |--- running_mean : Tensor + # |--- running_var : Tensor + # |--- num_batches_tracked : Tensor + # + # Version 2 + # self + # |--- weight : Tensor + # |--- bias : Tensor + # |--- bn : Module + # |--- weight : Tensor (moved from v1.self.gamma) + # |--- bias : Tensor (moved from v1.self.beta) + # |--- running_mean : Tensor (moved from v1.self.running_mean) + # |--- running_var : Tensor (moved from v1.self.running_var) + # |--- num_batches_tracked : Tensor (moved from v1.self.num_batches_tracked) + def _load_from_state_dict(self, state_dict, prefix, local_metadata, strict, missing_keys, unexpected_keys, error_msgs): + version = local_metadata.get('version', None) + if version is None or version == 1: + # BN related parameters and buffers were moved into the BN module for v2 + v2_to_v1_names = { + 'bn.weight': 'gamma', + 'bn.bias': 'beta', + 'bn.running_mean': 'running_mean', + 'bn.running_var': 'running_var', + 'bn.num_batches_tracked': 'num_batches_tracked', + } + for v2_name, v1_name in v2_to_v1_names.items(): + if prefix + v1_name in state_dict: + state_dict[prefix + v2_name] = state_dict[prefix + v1_name] + state_dict.pop(prefix + v1_name) + elif prefix + v2_name in state_dict: + # there was a brief period where forward compatibility + # for this module was broken (between + # https://github.com/pytorch/pytorch/pull/38478 + # and https://github.com/pytorch/pytorch/pull/38820) + # and modules emitted the v2 state_dict format while + # specifying that version == 1. This patches the forward + # compatibility issue by allowing the v2 style entries to + # be used. + pass + elif strict: + missing_keys.append(prefix + v2_name) + + super()._load_from_state_dict(state_dict, prefix, local_metadata, strict, + missing_keys, unexpected_keys, error_msgs) + + @classmethod + def from_float(cls, mod): + r"""Create a qat module from a float module or qparams_dict + + Args: `mod` a float module, either produced by torch.ao.quantization utilities + or directly from user + """ + # The ignore is because _FLOAT_MODULE is a TypeVar here where the bound + # has no __name__ (code is fine though) + assert type(mod) == cls._FLOAT_MODULE, 'qat.' + cls.__name__ + '.from_float only works for ' + \ + cls._FLOAT_MODULE.__name__ # type: ignore[attr-defined] + assert hasattr(mod, 'qconfig'), 'Input float module must have qconfig defined' + assert mod.qconfig, 'Input float module must have a valid qconfig' + qconfig = mod.qconfig + conv, bn = mod[0], mod[1] + qat_convbn = cls(conv.in_channels, conv.out_channels, conv.kernel_size, + conv.stride, conv.padding, conv.dilation, + conv.groups, conv.bias is not None, + conv.padding_mode, + bn.eps, bn.momentum, + False, + qconfig) + qat_convbn.weight = conv.weight + qat_convbn.bias = conv.bias + qat_convbn.bn.weight = bn.weight + qat_convbn.bn.bias = bn.bias + qat_convbn.bn.running_mean = bn.running_mean + qat_convbn.bn.running_var = bn.running_var + # mypy error: Cannot determine type of 'num_batches_tracked' + qat_convbn.bn.num_batches_tracked = bn.num_batches_tracked # type: ignore[has-type] + return qat_convbn + + def to_float(self): + cls = type(self) + conv = cls._FLOAT_CONV_MODULE( # type: ignore[attr-defined] + self.in_channels, + self.out_channels, + self.kernel_size, + self.stride, + self.padding, + self.dilation, + self.groups, + self.bias is not None, + self.padding_mode) + conv.weight = torch.nn.Parameter(self.weight.detach()) + if self.bias is not None: + conv.bias = torch.nn.Parameter(self.bias.detach()) + + if cls._FLOAT_BN_MODULE: # type: ignore[attr-defined] + # fuse bn into conv + conv.weight, conv.bias = fuse_conv_bn_weights( + conv.weight, + conv.bias, + self.bn.running_mean, + self.bn.running_var, + self.bn.eps, + self.bn.weight, + self.bn.bias + ) + + if cls._FLOAT_RELU_MODULE: # type: ignore[attr-defined] + modules = [] + modules.append(conv) + relu = cls._FLOAT_RELU_MODULE() # type: ignore[attr-defined] + modules.append(relu) + conv_relu = cls._FUSED_FLOAT_MODULE(*modules) # type: ignore[attr-defined] + conv_relu.train(self.training) + return conv_relu + else: + conv.train(self.training) + return conv + +class ConvBn1d(_ConvBnNd, nn.Conv1d): + r""" + A ConvBn1d module is a module fused from Conv1d and BatchNorm1d, + attached with FakeQuantize modules for weight, + used in quantization aware training. + + We combined the interface of :class:`torch.nn.Conv1d` and + :class:`torch.nn.BatchNorm1d`. + + Similar to :class:`torch.nn.Conv1d`, with FakeQuantize modules initialized + to default. + + Attributes: + freeze_bn: + weight_fake_quant: fake quant module for weight + + """ + _FLOAT_BN_MODULE = nn.BatchNorm1d + _FLOAT_RELU_MODULE = None + _FLOAT_MODULE = nni.ConvBn1d + _FLOAT_CONV_MODULE = nn.Conv1d + + def __init__(self, + # Conv1d args + in_channels, out_channels, kernel_size, stride=1, + padding=0, dilation=1, groups=1, + bias=None, + padding_mode='zeros', + # BatchNorm1d args + # num_features: out_channels + eps=1e-05, momentum=0.1, + # affine: True + # track_running_stats: True + # Args for this module + freeze_bn=False, + qconfig=None): + kernel_size = _single(kernel_size) + stride = _single(stride) + padding = _single(padding) + dilation = _single(dilation) + _ConvBnNd.__init__(self, in_channels, out_channels, kernel_size, stride, + padding, dilation, False, _single(0), groups, bias, padding_mode, + eps, momentum, freeze_bn, qconfig, dim=1) + +class ConvBnReLU1d(ConvBn1d): + r""" + A ConvBnReLU1d module is a module fused from Conv1d, BatchNorm1d and ReLU, + attached with FakeQuantize modules for weight, + used in quantization aware training. + + We combined the interface of :class:`torch.nn.Conv1d` and + :class:`torch.nn.BatchNorm1d` and :class:`torch.nn.ReLU`. + + Similar to `torch.nn.Conv1d`, with FakeQuantize modules initialized to + default. + + Attributes: + weight_fake_quant: fake quant module for weight + + """ + # base class defines _FLOAT_MODULE as "ConvBn1d" + _FLOAT_MODULE = nni.ConvBnReLU1d # type: ignore[assignment] + _FLOAT_CONV_MODULE = nn.Conv1d + _FLOAT_BN_MODULE = nn.BatchNorm1d + _FLOAT_RELU_MODULE = nn.ReLU # type: ignore[assignment] + # module class after fusing bn into conv + _FUSED_FLOAT_MODULE = nni.ConvReLU1d + + def __init__(self, + # Conv1d args + in_channels, out_channels, kernel_size, stride=1, + padding=0, dilation=1, groups=1, + bias=None, + padding_mode='zeros', + # BatchNorm1d args + # num_features: out_channels + eps=1e-05, momentum=0.1, + # affine: True + # track_running_stats: True + # Args for this module + freeze_bn=False, + qconfig=None): + super().__init__(in_channels, out_channels, kernel_size, stride, + padding, dilation, groups, bias, + padding_mode, eps, momentum, + freeze_bn, + qconfig) + + def forward(self, input): + return F.relu(ConvBn1d._forward(self, input)) + + @classmethod + def from_float(cls, mod): + return super(ConvBnReLU1d, cls).from_float(mod) + +class ConvReLU1d(nnqat.Conv1d, nni._FusedModule): + r"""A ConvReLU1d module is a fused module of Conv1d and ReLU, attached with + FakeQuantize modules for weight for + quantization aware training. + + We combined the interface of :class:`~torch.nn.Conv1d` and + :class:`~torch.nn.BatchNorm1d`. + + Attributes: + weight_fake_quant: fake quant module for weight + + """ + _FLOAT_MODULE = nni.ConvReLU1d + _FLOAT_CONV_MODULE = nn.Conv1d + _FLOAT_BN_MODULE = None + _FLOAT_RELU_MODULE = nn.ReLU + + def __init__(self, in_channels, out_channels, kernel_size, stride=1, + padding=0, dilation=1, groups=1, + bias=True, padding_mode='zeros', + qconfig=None): + super().__init__(in_channels, out_channels, kernel_size, + stride=stride, padding=padding, dilation=dilation, + groups=groups, bias=bias, padding_mode=padding_mode, + qconfig=qconfig) + assert qconfig, 'qconfig must be provided for QAT module' + self.qconfig = qconfig + self.weight_fake_quant = self.qconfig.weight() + + def forward(self, input): + return F.relu( + self._conv_forward(input, self.weight_fake_quant(self.weight), self.bias)) + + @classmethod + def from_float(cls, mod): + return super(ConvReLU1d, cls).from_float(mod) + +class ConvBn2d(_ConvBnNd, nn.Conv2d): + r""" + A ConvBn2d module is a module fused from Conv2d and BatchNorm2d, + attached with FakeQuantize modules for weight, + used in quantization aware training. + + We combined the interface of :class:`torch.nn.Conv2d` and + :class:`torch.nn.BatchNorm2d`. + + Similar to :class:`torch.nn.Conv2d`, with FakeQuantize modules initialized + to default. + + Attributes: + freeze_bn: + weight_fake_quant: fake quant module for weight + + """ + _FLOAT_MODULE = nni.ConvBn2d + _FLOAT_CONV_MODULE = nn.Conv2d + _FLOAT_BN_MODULE = nn.BatchNorm2d + _FLOAT_RELU_MODULE = None + + def __init__(self, + # ConvNd args + in_channels, out_channels, kernel_size, stride=1, + padding=0, dilation=1, groups=1, + bias=None, + padding_mode='zeros', + # BatchNorm2d args + # num_features: out_channels + eps=1e-05, momentum=0.1, + # affine: True + # track_running_stats: True + # Args for this module + freeze_bn=False, + qconfig=None): + kernel_size = _pair(kernel_size) + stride = _pair(stride) + padding = _pair(padding) + dilation = _pair(dilation) + _ConvBnNd.__init__(self, in_channels, out_channels, kernel_size, stride, + padding, dilation, False, _pair(0), groups, bias, padding_mode, + eps, momentum, freeze_bn, qconfig, dim=2) + +class ConvBnReLU2d(ConvBn2d): + r""" + A ConvBnReLU2d module is a module fused from Conv2d, BatchNorm2d and ReLU, + attached with FakeQuantize modules for weight, + used in quantization aware training. + + We combined the interface of :class:`torch.nn.Conv2d` and + :class:`torch.nn.BatchNorm2d` and :class:`torch.nn.ReLU`. + + Similar to `torch.nn.Conv2d`, with FakeQuantize modules initialized to + default. + + Attributes: + weight_fake_quant: fake quant module for weight + + """ + # base class defines _FLOAT_MODULE as "ConvBn2d" + _FLOAT_MODULE = nni.ConvBnReLU2d # type: ignore[assignment] + _FLOAT_CONV_MODULE = nn.Conv2d + _FLOAT_BN_MODULE = nn.BatchNorm2d + _FLOAT_RELU_MODULE = nn.ReLU # type: ignore[assignment] + # module class after fusing bn into conv + _FUSED_FLOAT_MODULE = nni.ConvReLU2d + + def __init__(self, + # Conv2d args + in_channels, out_channels, kernel_size, stride=1, + padding=0, dilation=1, groups=1, + bias=None, + padding_mode='zeros', + # BatchNorm2d args + # num_features: out_channels + eps=1e-05, momentum=0.1, + # affine: True + # track_running_stats: True + # Args for this module + freeze_bn=False, + qconfig=None): + super().__init__(in_channels, out_channels, kernel_size, stride, + padding, dilation, groups, bias, + padding_mode, eps, momentum, + freeze_bn, + qconfig) + + def forward(self, input): + return F.relu(ConvBn2d._forward(self, input)) + + @classmethod + def from_float(cls, mod): + return super(ConvBnReLU2d, cls).from_float(mod) + +class ConvReLU2d(nnqat.Conv2d, nni._FusedModule): + r"""A ConvReLU2d module is a fused module of Conv2d and ReLU, attached with + FakeQuantize modules for weight for + quantization aware training. + + We combined the interface of :class:`~torch.nn.Conv2d` and + :class:`~torch.nn.BatchNorm2d`. + + Attributes: + weight_fake_quant: fake quant module for weight + + """ + _FLOAT_MODULE = nni.ConvReLU2d + _FLOAT_CONV_MODULE = nn.Conv2d + _FLOAT_BN_MODULE = None + _FLOAT_RELU_MODULE = nn.ReLU + + def __init__(self, in_channels, out_channels, kernel_size, stride=1, + padding=0, dilation=1, groups=1, + bias=True, padding_mode='zeros', + qconfig=None): + super().__init__(in_channels, out_channels, kernel_size, + stride=stride, padding=padding, dilation=dilation, + groups=groups, bias=bias, padding_mode=padding_mode, + qconfig=qconfig) + assert qconfig, 'qconfig must be provided for QAT module' + self.qconfig = qconfig + self.weight_fake_quant = self.qconfig.weight() + + def forward(self, input): + return F.relu( + self._conv_forward(input, self.weight_fake_quant(self.weight), self.bias)) + + @classmethod + def from_float(cls, mod): + return super(ConvReLU2d, cls).from_float(mod) + +class ConvBn3d(_ConvBnNd, nn.Conv3d): + r""" + A ConvBn3d module is a module fused from Conv3d and BatchNorm3d, + attached with FakeQuantize modules for weight, + used in quantization aware training. + + We combined the interface of :class:`torch.nn.Conv3d` and + :class:`torch.nn.BatchNorm3d`. + + Similar to :class:`torch.nn.Conv3d`, with FakeQuantize modules initialized + to default. + + Attributes: + freeze_bn: + weight_fake_quant: fake quant module for weight + + """ + _FLOAT_MODULE = nni.ConvBn3d + _FLOAT_CONV_MODULE = nn.Conv3d + _FLOAT_BN_MODULE = nn.BatchNorm3d + _FLOAT_RELU_MODULE = None + + def __init__( + self, + # ConvNd args + in_channels, + out_channels, + kernel_size, + stride=1, + padding=0, + dilation=1, + groups=1, + bias=None, + padding_mode="zeros", + # BatchNorm3d args + # num_features: out_channels + eps=1e-05, + momentum=0.1, + # affine: True + # track_running_stats: True + # Args for this module + freeze_bn=False, + qconfig=None, + ): + kernel_size = _triple(kernel_size) + stride = _triple(stride) + padding = _triple(padding) + dilation = _triple(dilation) + _ConvBnNd.__init__( + self, + in_channels, + out_channels, + kernel_size, + stride, + padding, + dilation, + False, + _triple(0), + groups, + bias, + padding_mode, + eps, + momentum, + freeze_bn, + qconfig, + dim=3, + ) + +class ConvBnReLU3d(ConvBn3d): + r""" + A ConvBnReLU3d module is a module fused from Conv3d, BatchNorm3d and ReLU, + attached with FakeQuantize modules for weight, + used in quantization aware training. + + We combined the interface of :class:`torch.nn.Conv3d` and + :class:`torch.nn.BatchNorm3d` and :class:`torch.nn.ReLU`. + + Similar to `torch.nn.Conv3d`, with FakeQuantize modules initialized to + default. + + Attributes: + weight_fake_quant: fake quant module for weight + + """ + _FLOAT_MODULE = nni.ConvBnReLU3d # type: ignore[assignment] + _FLOAT_CONV_MODULE = nn.Conv3d + _FLOAT_BN_MODULE = nn.BatchNorm3d + _FLOAT_RELU_MODULE = nn.ReLU # type: ignore[assignment] + # module class after fusing bn into conv + _FUSED_FLOAT_MODULE = nni.ConvReLU3d + + def __init__( + self, + # Conv3d args + in_channels, + out_channels, + kernel_size, + stride=1, + padding=0, + dilation=1, + groups=1, + bias=None, + padding_mode="zeros", + # BatchNorm3d args + # num_features: out_channels + eps=1e-05, + momentum=0.1, + # affine: True + # track_running_stats: True + # Args for this module + freeze_bn=False, + qconfig=None, + ): + super().__init__( + in_channels, + out_channels, + kernel_size, + stride, + padding, + dilation, + groups, + bias, + padding_mode, + eps, + momentum, + freeze_bn, + qconfig, + ) + + def forward(self, input): + return F.relu(ConvBn3d._forward(self, input)) + + @classmethod + def from_float(cls, mod): + return super(ConvBnReLU3d, cls).from_float(mod) + +class ConvReLU3d(nnqat.Conv3d, nni._FusedModule): + r"""A ConvReLU3d module is a fused module of Conv3d and ReLU, attached with + FakeQuantize modules for weight for + quantization aware training. + + We combined the interface of :class:`~torch.nn.Conv3d` and + :class:`~torch.nn.BatchNorm3d`. + + Attributes: + weight_fake_quant: fake quant module for weight + + """ + _FLOAT_MODULE = nni.ConvReLU3d + _FLOAT_CONV_MODULE = nn.Conv3d + _FLOAT_BN_MODULE = None + _FLOAT_RELU_MODULE = nn.ReLU + + def __init__( + self, + in_channels, + out_channels, + kernel_size, + stride=1, + padding=0, + dilation=1, + groups=1, + bias=True, + padding_mode="zeros", + qconfig=None, + ): + super().__init__( + in_channels, + out_channels, + kernel_size, + stride=stride, + padding=padding, + dilation=dilation, + groups=groups, + bias=bias, + padding_mode=padding_mode, + qconfig=qconfig, + ) + assert qconfig, "qconfig must be provided for QAT module" + self.qconfig = qconfig + self.weight_fake_quant = self.qconfig.weight() + + def forward(self, input): + return F.relu( + self._conv_forward(input, self.weight_fake_quant(self.weight), self.bias) + ) + + @classmethod + def from_float(cls, mod): + return super(ConvReLU3d, cls).from_float(mod) + +def update_bn_stats(mod): + if type(mod) in {ConvBnReLU1d, ConvBnReLU2d, ConvBnReLU3d, ConvBn1d, ConvBn2d, ConvBn3d}: + mod.update_bn_stats() + +def freeze_bn_stats(mod): + if type(mod) in {ConvBnReLU1d, ConvBnReLU2d, ConvBnReLU3d, ConvBn1d, ConvBn2d, ConvBn3d}: + mod.freeze_bn_stats() diff --git a/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/linear_fused.py b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/linear_fused.py new file mode 100644 index 0000000000000000000000000000000000000000..3bff8e5f9f806697bb87ef3445853f408aae373a --- /dev/null +++ b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/linear_fused.py @@ -0,0 +1,170 @@ +import torch +import torch.nn as nn +import torch.ao.nn.intrinsic as nni +import torch.nn.functional as F +from torch.nn import init +from torch.nn.parameter import Parameter +from torch.nn.utils.fusion import fuse_linear_bn_weights + +__all__ = [ + "LinearBn1d", +] + +class LinearBn1d(nn.modules.linear.Linear, nni._FusedModule): + r""" + A LinearBn1d module is a module fused from Linear and BatchNorm1d, attached + with FakeQuantize modules for weight, used in quantization aware training. + + We combined the interface of :class:`torch.nn.Linear` and + :class:torch.nn.BatchNorm1d`. + + Similar to :class:`torch.nn.Linear`, with FakeQuantize modules initialized + to default. + + Attributes: + freeze_bn: + weight_fake_quant: fake quant module for weight + + """ + def __init__(self, + # Linear args + in_features, out_features, bias=True, + # BatchNorm1d args + # num_features: out_features + eps=1e-05, momentum=0.1, + # affine: True + # track_running_stats: True + # Args for this module + freeze_bn=False, + qconfig=None): + nn.modules.linear.Linear.__init__(self, in_features, out_features, bias) + assert qconfig, 'qconfig must be provided for QAT module' + self.qconfig = qconfig + self.freeze_bn = freeze_bn if self.training else True + self.bn = nn.BatchNorm1d(out_features, eps, momentum, True, True) + self.weight_fake_quant = self.qconfig.weight() + if bias: + self.bias = Parameter(torch.empty(out_features)) + else: + self.register_parameter('bias', None) + self.reset_bn_parameters() + + # this needs to be called after reset_bn_parameters, + # as they modify the same state + if self.training: + if freeze_bn: + self.freeze_bn_stats() + else: + self.update_bn_stats() + else: + self.freeze_bn_stats() + + def reset_running_stats(self): + self.bn.reset_running_stats() + + def reset_bn_parameters(self): + self.bn.reset_running_stats() + init.uniform_(self.bn.weight) + init.zeros_(self.bn.bias) + + def reset_parameters(self): + super().reset_parameters() + + def update_bn_stats(self): + self.freeze_bn = False + self.bn.training = True + return self + + def freeze_bn_stats(self): + self.freeze_bn = True + self.bn.training = False + return self + + def forward(self, input): + assert self.bn.running_var is not None + + # Scale the linear weights by BN's running statistics to reduce + # weight jitter, see https://arxiv.org/pdf/1806.08342.pdf, page 18 + # for motivation. + # + # Instead of + # + # x1 = F.linear(x0, fq(w), b) + # x2 = self.bn(x1) + # + # We have + # + # # scale the weight by previous batch's running statistics + # scale_factor = bn.w / bn.running_std_from_prev_batch + # # do the linear transformation without bias + # x1_scaled = F.linear(x0, fq(w * scale_factor), 0) + # # reverse the scaling and add original bias + # x1_orig = x1_scaled / scale_factor + b + # x2 = self.bn(x1_orig) + + running_std = torch.sqrt(self.bn.running_var + self.bn.eps) + scale_factor = self.bn.weight / running_std + weight_shape = [1] * len(self.weight.shape) + weight_shape[0] = -1 + bias_shape = [1] * len(self.weight.shape) + bias_shape[1] = -1 + scaled_weight = self.weight_fake_quant(self.weight * scale_factor.reshape(weight_shape)) + if self.bias is not None: + zero_bias = torch.zeros_like(self.bias) + else: + zero_bias = torch.zeros(self.out_features, device=scaled_weight.device) + linear_out = F.linear(input, scaled_weight, zero_bias) + linear_out_orig = linear_out / scale_factor.reshape(bias_shape) + if self.bias is not None: + linear_out_orig = linear_out_orig + self.bias.reshape(bias_shape) + bn_out = self.bn(linear_out_orig) + return bn_out + + def train(self, mode=True): + """ + Batchnorm's training behavior is using the self.training flag. Prevent + changing it if BN is frozen. This makes sure that calling `model.train()` + on a model with a frozen BN will behave properly. + """ + self.training = mode + if not self.freeze_bn: + for module in self.children(): + module.train(mode) + return self + + @classmethod + def from_float(cls, mod): + r"""Create a qat module from a float module or qparams_dict + + Args: `mod' a float module, either produced by torch.ao.quantization + utilities or directly from user + """ + assert type(mod) == nni.LinearBn1d, 'qat.' + cls.__name__ + \ + '.from_float only works for ' + nni.LinearBn1d.__name__ + assert hasattr(mod, 'qconfig'), 'Input float module must have qconfig defined' + assert mod.qconfig, 'Input float module must have a valid config' + qconfig = mod.qconfig + linear, bn = mod[0], mod[1] + qat_linearbn = cls(linear.in_features, linear.out_features, linear.bias is not None, + bn.eps, bn.momentum, + False, qconfig) + qat_linearbn.weight = linear.weight + qat_linearbn.bias = linear.bias + qat_linearbn.bn.weight = bn.weight + qat_linearbn.bn.bias = bn.bias + qat_linearbn.bn.running_mean = bn.running_mean + qat_linearbn.bn.running_var = bn.running_var + qat_linearbn.bn.num_batches_tracked = bn.num_batches_tracked + return qat_linearbn + + def to_float(self): + linear = torch.nn.Linear(self.in_features, self.out_features) + linear.weight, linear.bias = fuse_linear_bn_weights( + self.weight, + self.bias, + self.bn.running_mean, + self.bn.running_var, + self.bn.eps, + self.bn.weight, + self.bn.bias) + return linear diff --git a/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/linear_relu.py b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/linear_relu.py new file mode 100644 index 0000000000000000000000000000000000000000..93b195370834275643251b6a57e77fe1b8347a80 --- /dev/null +++ b/deepseekvl2/lib/python3.10/site-packages/torch/ao/nn/intrinsic/qat/modules/linear_relu.py @@ -0,0 +1,48 @@ +import torch +import torch.ao.nn.qat as nnqat +import torch.ao.nn.intrinsic as nni +import torch.nn.functional as F + +class LinearReLU(nnqat.Linear, nni._FusedModule): + r""" + A LinearReLU module fused from Linear and ReLU modules, attached with + FakeQuantize modules for weight, used in + quantization aware training. + + We adopt the same interface as :class:`torch.nn.Linear`. + + Similar to `torch.ao.nn.intrinsic.LinearReLU`, with FakeQuantize modules initialized to + default. + + Attributes: + weight: fake quant module for weight + + Examples:: + + >>> # xdoctest: +SKIP + >>> m = nn.qat.LinearReLU(20, 30) + >>> input = torch.randn(128, 20) + >>> output = m(input) + >>> print(output.size()) + torch.Size([128, 30]) + """ + _FLOAT_MODULE = nni.LinearReLU + + def __init__(self, in_features, out_features, bias=True, + qconfig=None): + super().__init__(in_features, out_features, bias, qconfig) + + def forward(self, input): + return F.relu(F.linear(input, self.weight_fake_quant(self.weight), self.bias)) + + @classmethod + def from_float(cls, mod): + return super(LinearReLU, cls).from_float(mod) + + def to_float(self): + linear = torch.nn.Linear(self.in_features, self.out_features, self.bias is not None) + linear.weight = torch.nn.Parameter(self.weight.detach()) + if self.bias is not None: + linear.bias = torch.nn.Parameter(self.bias.detach()) + relu = torch.nn.ReLU() + return torch.ao.nn.intrinsic.LinearReLU(linear, relu)