training
¶
Classes¶
fastvideo.training.DistillationPipeline
¶
DistillationPipeline(model_path: str, fastvideo_args: TrainingArgs, required_config_modules: list[str] | None = None, loaded_modules: dict[str, Module] | None = None)
Bases: TrainingPipeline
A distillation pipeline for training a 3 step model. Inherits from TrainingPipeline to reuse training infrastructure.
Source code in fastvideo/training/training_pipeline.py
Functions¶
fastvideo.training.DistillationPipeline.apply_ema_to_model
¶
Apply EMA weights to the model for validation or inference.
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.DistillationPipeline.get_ema_2_model_copy
¶
Get a copy of the transformer_2 model with EMA weights applied.
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.DistillationPipeline.get_ema_model_copy
¶
Get a copy of the model with EMA weights applied.
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.DistillationPipeline.get_ema_stats
¶
Get EMA statistics for monitoring.
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.DistillationPipeline.initialize_training_pipeline
¶
initialize_training_pipeline(training_args: TrainingArgs)
Initialize the distillation training pipeline with multiple models.
Source code in fastvideo/training/distillation_pipeline.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
fastvideo.training.DistillationPipeline.initialize_validation_pipeline
abstractmethod
¶
initialize_validation_pipeline(training_args: TrainingArgs)
Initialize validation pipeline - must be implemented by subclasses.
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.DistillationPipeline.is_ema_ready
¶
is_ema_ready(current_step: int | None = None)
Check if EMA is ready for use (after ema_start_step).
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.DistillationPipeline.load_module_from_path
¶
load_module_from_path(model_path: str, module_type: str, training_args: TrainingArgs)
Load a module from a specific path using the same loading logic as the pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_path
|
str
|
Path to the model |
required |
module_type
|
str
|
Type of module to load (e.g., "transformer") |
required |
training_args
|
TrainingArgs
|
Training arguments |
required |
Returns:
| Type | Description |
|---|---|
|
The loaded module |
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.DistillationPipeline.reset_ema
¶
Reset EMA to current model weights.
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.DistillationPipeline.save_ema_weights
¶
Save EMA weights separately for inference purposes.
Source code in fastvideo/training/distillation_pipeline.py
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | |
fastvideo.training.DistillationPipeline.train
¶
Main training loop with distillation-specific logging.
Source code in fastvideo/training/distillation_pipeline.py
1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 | |
fastvideo.training.DistillationPipeline.visualize_intermediate_latents
¶
visualize_intermediate_latents(training_batch: TrainingBatch, training_args: TrainingArgs, step: int)
Add visualization data to tracker logging and save frames to disk.
Source code in fastvideo/training/distillation_pipeline.py
1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 | |
fastvideo.training.TrainingPipeline
¶
TrainingPipeline(model_path: str, fastvideo_args: TrainingArgs, required_config_modules: list[str] | None = None, loaded_modules: dict[str, Module] | None = None)
Bases: LoRAPipeline, ABC
A pipeline for training a model. All training pipelines should inherit from this class. All reusable components and code should be implemented in this class.
Source code in fastvideo/training/training_pipeline.py
Functions¶
fastvideo.training.TrainingPipeline.visualize_intermediate_latents
¶
visualize_intermediate_latents(training_batch: TrainingBatch, training_args: TrainingArgs, step: int)
Add visualization data to tracker logging and save frames to disk.
Source code in fastvideo/training/training_pipeline.py
fastvideo.training.WanTrainingPipeline
¶
WanTrainingPipeline(model_path: str, fastvideo_args: TrainingArgs, required_config_modules: list[str] | None = None, loaded_modules: dict[str, Module] | None = None)
Bases: TrainingPipeline
A training pipeline for Wan.
Source code in fastvideo/training/training_pipeline.py
Functions¶
fastvideo.training.WanTrainingPipeline.create_training_stages
¶
create_training_stages(training_args: TrainingArgs)
Modules¶
fastvideo.training.distillation_pipeline
¶
Classes¶
fastvideo.training.distillation_pipeline.DistillationPipeline
¶
DistillationPipeline(model_path: str, fastvideo_args: TrainingArgs, required_config_modules: list[str] | None = None, loaded_modules: dict[str, Module] | None = None)
Bases: TrainingPipeline
A distillation pipeline for training a 3 step model. Inherits from TrainingPipeline to reuse training infrastructure.
Source code in fastvideo/training/training_pipeline.py
Functions¶
fastvideo.training.distillation_pipeline.DistillationPipeline.apply_ema_to_model
¶Apply EMA weights to the model for validation or inference.
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.distillation_pipeline.DistillationPipeline.get_ema_2_model_copy
¶Get a copy of the transformer_2 model with EMA weights applied.
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.distillation_pipeline.DistillationPipeline.get_ema_model_copy
¶Get a copy of the model with EMA weights applied.
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.distillation_pipeline.DistillationPipeline.get_ema_stats
¶Get EMA statistics for monitoring.
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.distillation_pipeline.DistillationPipeline.initialize_training_pipeline
¶initialize_training_pipeline(training_args: TrainingArgs)
Initialize the distillation training pipeline with multiple models.
Source code in fastvideo/training/distillation_pipeline.py
75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 | |
fastvideo.training.distillation_pipeline.DistillationPipeline.initialize_validation_pipeline
abstractmethod
¶initialize_validation_pipeline(training_args: TrainingArgs)
Initialize validation pipeline - must be implemented by subclasses.
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.distillation_pipeline.DistillationPipeline.is_ema_ready
¶is_ema_ready(current_step: int | None = None)
Check if EMA is ready for use (after ema_start_step).
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.distillation_pipeline.DistillationPipeline.load_module_from_path
¶load_module_from_path(model_path: str, module_type: str, training_args: TrainingArgs)
Load a module from a specific path using the same loading logic as the pipeline.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model_path
|
str
|
Path to the model |
required |
module_type
|
str
|
Type of module to load (e.g., "transformer") |
required |
training_args
|
TrainingArgs
|
Training arguments |
required |
Returns:
| Type | Description |
|---|---|
|
The loaded module |
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.distillation_pipeline.DistillationPipeline.reset_ema
¶Reset EMA to current model weights.
Source code in fastvideo/training/distillation_pipeline.py
fastvideo.training.distillation_pipeline.DistillationPipeline.save_ema_weights
¶Save EMA weights separately for inference purposes.
Source code in fastvideo/training/distillation_pipeline.py
401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 | |
fastvideo.training.distillation_pipeline.DistillationPipeline.train
¶Main training loop with distillation-specific logging.
Source code in fastvideo/training/distillation_pipeline.py
1445 1446 1447 1448 1449 1450 1451 1452 1453 1454 1455 1456 1457 1458 1459 1460 1461 1462 1463 1464 1465 1466 1467 1468 1469 1470 1471 1472 1473 1474 1475 1476 1477 1478 1479 1480 1481 1482 1483 1484 1485 1486 1487 1488 1489 1490 1491 1492 1493 1494 1495 1496 1497 1498 1499 1500 1501 1502 1503 1504 1505 1506 1507 1508 1509 1510 1511 1512 1513 1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 1608 1609 1610 1611 1612 1613 1614 1615 1616 1617 1618 1619 1620 1621 1622 1623 1624 1625 1626 1627 1628 1629 1630 1631 1632 1633 1634 1635 1636 1637 1638 1639 1640 1641 1642 1643 1644 1645 1646 1647 1648 1649 1650 1651 1652 1653 1654 1655 1656 1657 1658 1659 1660 1661 1662 1663 1664 1665 1666 1667 1668 1669 1670 1671 1672 1673 1674 1675 1676 1677 1678 1679 1680 1681 1682 1683 1684 1685 1686 1687 1688 1689 1690 1691 1692 1693 1694 1695 1696 1697 1698 1699 1700 1701 1702 1703 1704 1705 1706 1707 1708 1709 1710 1711 1712 1713 1714 1715 1716 1717 1718 1719 1720 1721 1722 1723 1724 1725 1726 1727 1728 1729 1730 1731 1732 1733 1734 1735 1736 1737 1738 1739 1740 1741 1742 | |
fastvideo.training.distillation_pipeline.DistillationPipeline.visualize_intermediate_latents
¶visualize_intermediate_latents(training_batch: TrainingBatch, training_args: TrainingArgs, step: int)
Add visualization data to tracker logging and save frames to disk.
Source code in fastvideo/training/distillation_pipeline.py
1368 1369 1370 1371 1372 1373 1374 1375 1376 1377 1378 1379 1380 1381 1382 1383 1384 1385 1386 1387 1388 1389 1390 1391 1392 1393 1394 1395 1396 1397 1398 1399 1400 1401 1402 1403 1404 1405 1406 1407 1408 1409 1410 1411 1412 1413 1414 1415 1416 1417 1418 1419 1420 1421 1422 1423 1424 1425 1426 1427 1428 1429 1430 1431 1432 1433 1434 1435 1436 1437 1438 1439 1440 1441 1442 1443 | |
Functions¶
fastvideo.training.ode_causal_pipeline
¶
Classes¶
fastvideo.training.ode_causal_pipeline.ODEInitTrainingPipeline
¶
ODEInitTrainingPipeline(model_path: str, fastvideo_args: TrainingArgs, required_config_modules: list[str] | None = None, loaded_modules: dict[str, Module] | None = None)
Bases: TrainingPipeline
Training pipeline for ODE-init using precomputed denoising trajectories.
Supervision: predict the next latent in the stored trajectory by - feeding current latent at timestep t into the transformer to predict noise - stepping the scheduler with the predicted noise - minimizing MSE to the stored next latent at timestep t_next
Source code in fastvideo/training/training_pipeline.py
Functions¶
fastvideo.training.self_forcing_distillation_pipeline
¶
Classes¶
fastvideo.training.self_forcing_distillation_pipeline.SelfForcingDistillationPipeline
¶
SelfForcingDistillationPipeline(model_path: str, fastvideo_args: TrainingArgs, required_config_modules: list[str] | None = None, loaded_modules: dict[str, Module] | None = None)
Bases: DistillationPipeline
A self-forcing distillation pipeline that alternates between training the generator and critic based on the self-forcing methodology.
This implementation follows the self-forcing approach where: 1. Generator and critic are trained in alternating steps 2. Generator loss uses DMD-style loss with the critic as fake score 3. Critic loss trains the fake score model to distinguish real vs fake
Source code in fastvideo/training/training_pipeline.py
Functions¶
fastvideo.training.self_forcing_distillation_pipeline.SelfForcingDistillationPipeline.critic_loss
¶Compute critic loss using flow matching between noise and generator output. The critic learns to predict the flow from noise to the generator's output.
Source code in fastvideo/training/self_forcing_distillation_pipeline.py
fastvideo.training.self_forcing_distillation_pipeline.SelfForcingDistillationPipeline.generate_and_sync_list
¶Generate and synchronize random exit flags across distributed processes.
Source code in fastvideo/training/self_forcing_distillation_pipeline.py
fastvideo.training.self_forcing_distillation_pipeline.SelfForcingDistillationPipeline.generator_loss
¶Compute generator loss using DMD-style approach. The generator tries to fool the critic (fake_score_transformer).
Source code in fastvideo/training/self_forcing_distillation_pipeline.py
fastvideo.training.self_forcing_distillation_pipeline.SelfForcingDistillationPipeline.initialize_training_pipeline
¶initialize_training_pipeline(training_args: TrainingArgs)
Initialize the self-forcing training pipeline.
Source code in fastvideo/training/self_forcing_distillation_pipeline.py
fastvideo.training.self_forcing_distillation_pipeline.SelfForcingDistillationPipeline.train
¶Main training loop with self-forcing specific logging.
Source code in fastvideo/training/self_forcing_distillation_pipeline.py
958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 | |
fastvideo.training.self_forcing_distillation_pipeline.SelfForcingDistillationPipeline.train_one_step
¶Self-forcing training step that alternates between generator and critic training.
Source code in fastvideo/training/self_forcing_distillation_pipeline.py
669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 | |
fastvideo.training.self_forcing_distillation_pipeline.SelfForcingDistillationPipeline.visualize_intermediate_latents
¶visualize_intermediate_latents(training_batch: TrainingBatch, training_args: TrainingArgs, step: int)
Add visualization data to tracker logging and save frames to disk.
Source code in fastvideo/training/self_forcing_distillation_pipeline.py
823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 | |
Functions¶
fastvideo.training.trackers
¶
Utilities for logging metrics and artifacts to external trackers.
This module is inspired by the trackers implementation in https://github.com/huggingface/finetrainers and provides a minimal, shared interface that can be used across all FastVideo training pipelines.
Classes¶
fastvideo.training.trackers.BaseTracker
¶
Base tracker implementation.
The default tracker stores timing information but does not emit any logs.
Source code in fastvideo/training/trackers.py
Functions¶
fastvideo.training.trackers.BaseTracker.finish
¶ fastvideo.training.trackers.BaseTracker.log
¶Log metrics for the given step.
Source code in fastvideo/training/trackers.py
fastvideo.training.trackers.BaseTracker.log_artifacts
¶Log artifacts such as videos or images.
By default this is treated the same as :meth:log.
fastvideo.training.trackers.BaseTracker.video
¶video(data: Any, *, caption: str | None = None, fps: int | None = None, format: str | None = None) -> Any | None
Create a tracker specific video artifact.
Trackers that do not support video artifacts should return None.
Source code in fastvideo/training/trackers.py
fastvideo.training.trackers.DummyTracker
¶
Bases: BaseTracker
Tracker implementation used when logging is disabled.
Source code in fastvideo/training/trackers.py
fastvideo.training.trackers.SequentialTracker
¶
SequentialTracker(trackers: Iterable[BaseTracker])
Bases: BaseTracker
A tracker that forwards logging calls to a sequence of trackers.
Source code in fastvideo/training/trackers.py
fastvideo.training.trackers.Timer
dataclass
¶
Simple timer utility used by the trackers.
fastvideo.training.trackers.WandbTracker
¶
WandbTracker(experiment_name: str, log_dir: str, *, config: dict[str, Any] | None = None, run_name: str | None = None)
Bases: BaseTracker
Tracker implementation for Weights & Biases.
Source code in fastvideo/training/trackers.py
Functions¶
fastvideo.training.trackers.initialize_trackers
¶
initialize_trackers(trackers: Iterable[str], *, experiment_name: str, config: dict[str, Any] | None, log_dir: str, run_name: str | None = None) -> BaseTracker
Create tracker instances based on trackers configuration.
Source code in fastvideo/training/trackers.py
fastvideo.training.training_pipeline
¶
Classes¶
fastvideo.training.training_pipeline.TrainingPipeline
¶
TrainingPipeline(model_path: str, fastvideo_args: TrainingArgs, required_config_modules: list[str] | None = None, loaded_modules: dict[str, Module] | None = None)
Bases: LoRAPipeline, ABC
A pipeline for training a model. All training pipelines should inherit from this class. All reusable components and code should be implemented in this class.
Source code in fastvideo/training/training_pipeline.py
Functions¶
fastvideo.training.training_pipeline.TrainingPipeline.visualize_intermediate_latents
¶visualize_intermediate_latents(training_batch: TrainingBatch, training_args: TrainingArgs, step: int)
Add visualization data to tracker logging and save frames to disk.
Source code in fastvideo/training/training_pipeline.py
Functions¶
fastvideo.training.training_utils
¶
Classes¶
fastvideo.training.training_utils.EMA_FSDP
¶
FSDP2-friendly EMA with two modes
- mode="local_shard" (default): maintain float32 CPU EMA of local parameter shards on every rank. Provides a context manager to temporarily swap EMA weights into the live model for teacher forward.
- mode="rank0_full": maintain a consolidated float32 CPU EMA of full parameters on rank 0 only using gather_state_dict_on_cpu_rank0(). Useful for checkpoint export; not for teacher forward.
Usage (local_shard for CM teacher): ema = EMA_FSDP(model, decay=0.999, mode="local_shard") for step in ...: ema.update(model) with ema.apply_to_model(model): with torch.no_grad(): y_teacher = model(...)
Usage (rank0_full for export): ema = EMA_FSDP(model, decay=0.999, mode="rank0_full") ema.update(model) ema.state_dict() # on rank 0
Source code in fastvideo/training/training_utils.py
Functions¶
fastvideo.training.training_utils.EMA_FSDP.copy_to_unwrapped
¶Copy EMA weights into a non-sharded (unwrapped) module. Intended for export/eval. For mode="rank0_full", only rank 0 has the full EMA state.
Source code in fastvideo/training/training_utils.py
Functions¶
fastvideo.training.training_utils.clip_grad_norm_
¶
clip_grad_norm_(parameters: Tensor | list[Tensor], max_norm: float, norm_type: float = 2.0, error_if_nonfinite: bool = False, foreach: bool | None = None, pp_mesh: DeviceMesh | None = None) -> Tensor
Clip the gradient norm of parameters.
Gradient norm clipping requires computing the gradient norm over the entire model.
torch.nn.utils.clip_grad_norm_ only computes gradient norm along DP/FSDP/TP dimensions.
We need to manually reduce the gradient norm across PP stages.
See https://github.com/pytorch/torchtitan/issues/596 for details.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parameters
|
`torch.Tensor` or `List[torch.Tensor]`
|
Tensors that will have gradients normalized. |
required |
max_norm
|
`float`
|
Maximum norm of the gradients after clipping. |
required |
norm_type
|
`float`, defaults to `2.0`
|
Type of p-norm to use. Can be |
2.0
|
error_if_nonfinite
|
`bool`, defaults to `False`
|
If |
False
|
foreach
|
`bool`, defaults to `None`
|
Use the faster foreach-based implementation. If |
None
|
pp_mesh
|
`torch.distributed.device_mesh.DeviceMesh`, defaults to `None`
|
Pipeline parallel device mesh. If not |
None
|
Returns:
| Type | Description |
|---|---|
Tensor
|
|
Source code in fastvideo/training/training_utils.py
fastvideo.training.training_utils.compute_density_for_timestep_sampling
¶
compute_density_for_timestep_sampling(weighting_scheme: str, batch_size: int, generator, logit_mean: float | None = None, logit_std: float | None = None, mode_scale: float | None = None)
Compute the density for sampling the timesteps when doing SD3 training.
Courtesy: This was contributed by Rafie Walker in https://github.com/huggingface/diffusers/pull/8528.
SD3 paper reference: https://arxiv.org/abs/2403.03206v1.
Source code in fastvideo/training/training_utils.py
fastvideo.training.training_utils.custom_to_hf_state_dict
¶
custom_to_hf_state_dict(state_dict: dict[str, Any] | Iterator[tuple[str, Tensor]], reverse_param_names_mapping: dict[str, tuple[str, int, int]]) -> dict[str, Any]
Convert fastvideo's custom model format to diffusers format using reverse_param_names_mapping.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
state_dict
|
dict[str, Any] | Iterator[tuple[str, Tensor]]
|
State dict in fastvideo's custom format |
required |
reverse_param_names_mapping
|
dict[str, tuple[str, int, int]]
|
Reverse mapping from fastvideo's custom format to diffusers format |
required |
Returns:
| Type | Description |
|---|---|
dict[str, Any]
|
State dict in diffusers format |
Source code in fastvideo/training/training_utils.py
1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 | |
fastvideo.training.training_utils.get_constant_schedule
¶
get_constant_schedule(optimizer: Optimizer, last_epoch: int = -1) -> LambdaLR
Create a schedule with a constant learning rate, using the learning rate set in optimizer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
optimizer
|
[`~torch.optim.Optimizer`]
|
The optimizer for which to schedule the learning rate. |
required |
last_epoch
|
`int`, *optional*, defaults to -1
|
The index of the last epoch when resuming training. |
-1
|
Return
torch.optim.lr_scheduler.LambdaLR with the appropriate schedule.
Source code in fastvideo/training/training_utils.py
fastvideo.training.training_utils.get_constant_schedule_with_warmup
¶
get_constant_schedule_with_warmup(optimizer: Optimizer, num_warmup_steps: int, last_epoch: int = -1) -> LambdaLR
Create a schedule with a constant learning rate preceded by a warmup period during which the learning rate increases linearly between 0 and the initial lr set in the optimizer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
optimizer
|
[`~torch.optim.Optimizer`]
|
The optimizer for which to schedule the learning rate. |
required |
num_warmup_steps
|
`int`
|
The number of steps for the warmup phase. |
required |
last_epoch
|
`int`, *optional*, defaults to -1
|
The index of the last epoch when resuming training. |
-1
|
Return
torch.optim.lr_scheduler.LambdaLR with the appropriate schedule.
Source code in fastvideo/training/training_utils.py
fastvideo.training.training_utils.get_cosine_schedule_with_min_lr
¶
get_cosine_schedule_with_min_lr(optimizer: Optimizer, num_warmup_steps: int, num_training_steps: int, min_lr_ratio: float = 0.1, num_cycles: float = 0.5, last_epoch: int = -1) -> LambdaLR
Create a schedule with a learning rate that decreases following the values of the cosine function between the initial lr set in the optimizer to a minimum lr (min_lr_ratio * initial_lr), after a warmup period during which it increases linearly between 0 and the initial lr set in the optimizer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
optimizer
|
[`~torch.optim.Optimizer`]
|
The optimizer for which to schedule the learning rate. |
required |
num_warmup_steps
|
`int`
|
The number of steps for the warmup phase. |
required |
num_training_steps
|
`int`
|
The total number of training steps. |
required |
min_lr_ratio
|
`float`, *optional*, defaults to 0.1
|
The ratio of minimum learning rate to initial learning rate. |
0.1
|
num_cycles
|
`float`, *optional*, defaults to 0.5
|
The number of periods of the cosine function in a schedule. |
0.5
|
last_epoch
|
`int`, *optional*, defaults to -1
|
The index of the last epoch when resuming training. |
-1
|
Return
torch.optim.lr_scheduler.LambdaLR with the appropriate schedule.
Source code in fastvideo/training/training_utils.py
fastvideo.training.training_utils.get_cosine_schedule_with_warmup
¶
get_cosine_schedule_with_warmup(optimizer: Optimizer, num_warmup_steps: int, num_training_steps: int, num_cycles: float = 0.5, last_epoch: int = -1) -> LambdaLR
Create a schedule with a learning rate that decreases following the values of the cosine function between the initial lr set in the optimizer to 0, after a warmup period during which it increases linearly between 0 and the initial lr set in the optimizer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
optimizer
|
[`~torch.optim.Optimizer`]
|
The optimizer for which to schedule the learning rate. |
required |
num_warmup_steps
|
`int`
|
The number of steps for the warmup phase. |
required |
num_training_steps
|
`int`
|
The total number of training steps. |
required |
num_periods
|
`float`, *optional*, defaults to 0.5
|
The number of periods of the cosine function in a schedule (the default is to just decrease from the max value to 0 following a half-cosine). |
required |
last_epoch
|
`int`, *optional*, defaults to -1
|
The index of the last epoch when resuming training. |
-1
|
Return
torch.optim.lr_scheduler.LambdaLR with the appropriate schedule.
Source code in fastvideo/training/training_utils.py
fastvideo.training.training_utils.get_cosine_with_hard_restarts_schedule_with_warmup
¶
get_cosine_with_hard_restarts_schedule_with_warmup(optimizer: Optimizer, num_warmup_steps: int, num_training_steps: int, num_cycles: int = 1, last_epoch: int = -1) -> LambdaLR
Create a schedule with a learning rate that decreases following the values of the cosine function between the initial lr set in the optimizer to 0, with several hard restarts, after a warmup period during which it increases linearly between 0 and the initial lr set in the optimizer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
optimizer
|
[`~torch.optim.Optimizer`]
|
The optimizer for which to schedule the learning rate. |
required |
num_warmup_steps
|
`int`
|
The number of steps for the warmup phase. |
required |
num_training_steps
|
`int`
|
The total number of training steps. |
required |
num_cycles
|
`int`, *optional*, defaults to 1
|
The number of hard restarts to use. |
1
|
last_epoch
|
`int`, *optional*, defaults to -1
|
The index of the last epoch when resuming training. |
-1
|
Return
torch.optim.lr_scheduler.LambdaLR with the appropriate schedule.
Source code in fastvideo/training/training_utils.py
fastvideo.training.training_utils.get_linear_schedule_with_warmup
¶
get_linear_schedule_with_warmup(optimizer: Optimizer, num_warmup_steps: int, num_training_steps: int, last_epoch: int = -1) -> LambdaLR
Create a schedule with a learning rate that decreases linearly from the initial lr set in the optimizer to 0, after a warmup period during which it increases linearly from 0 to the initial lr set in the optimizer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
optimizer
|
[`~torch.optim.Optimizer`]
|
The optimizer for which to schedule the learning rate. |
required |
num_warmup_steps
|
`int`
|
The number of steps for the warmup phase. |
required |
num_training_steps
|
`int`
|
The total number of training steps. |
required |
last_epoch
|
`int`, *optional*, defaults to -1
|
The index of the last epoch when resuming training. |
-1
|
Return
torch.optim.lr_scheduler.LambdaLR with the appropriate schedule.
Source code in fastvideo/training/training_utils.py
fastvideo.training.training_utils.get_piecewise_constant_schedule
¶
get_piecewise_constant_schedule(optimizer: Optimizer, step_rules: str, last_epoch: int = -1) -> LambdaLR
Create a schedule with a constant learning rate, using the learning rate set in optimizer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
optimizer
|
[`~torch.optim.Optimizer`]
|
The optimizer for which to schedule the learning rate. |
required |
step_rules
|
`string`
|
The rules for the learning rate. ex: rule_steps="1:10,0.1:20,0.01:30,0.005" it means that the learning rate if multiple 1 for the first 10 steps, multiple 0.1 for the next 20 steps, multiple 0.01 for the next 30 steps and multiple 0.005 for the other steps. |
required |
last_epoch
|
`int`, *optional*, defaults to -1
|
The index of the last epoch when resuming training. |
-1
|
Return
torch.optim.lr_scheduler.LambdaLR with the appropriate schedule.
Source code in fastvideo/training/training_utils.py
fastvideo.training.training_utils.get_polynomial_decay_schedule_with_warmup
¶
get_polynomial_decay_schedule_with_warmup(optimizer: Optimizer, num_warmup_steps: int, num_training_steps: int, lr_end: float = 1e-07, power: float = 1.0, last_epoch: int = -1) -> LambdaLR
Create a schedule with a learning rate that decreases as a polynomial decay from the initial lr set in the optimizer to end lr defined by lr_end, after a warmup period during which it increases linearly from 0 to the initial lr set in the optimizer.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
optimizer
|
[`~torch.optim.Optimizer`]
|
The optimizer for which to schedule the learning rate. |
required |
num_warmup_steps
|
`int`
|
The number of steps for the warmup phase. |
required |
num_training_steps
|
`int`
|
The total number of training steps. |
required |
lr_end
|
`float`, *optional*, defaults to 1e-7
|
The end LR. |
1e-07
|
power
|
`float`, *optional*, defaults to 1.0
|
Power factor. |
1.0
|
last_epoch
|
`int`, *optional*, defaults to -1
|
The index of the last epoch when resuming training. |
-1
|
Note: power defaults to 1.0 as in the fairseq implementation, which in turn is based on the original BERT implementation at https://github.com/google-research/bert/blob/f39e881b169b9d53bea03d2d341b31707a6c052b/optimization.py#L37
Return
torch.optim.lr_scheduler.LambdaLR with the appropriate schedule.
Source code in fastvideo/training/training_utils.py
fastvideo.training.training_utils.get_scheduler
¶
get_scheduler(name: str | SchedulerType, optimizer: Optimizer, step_rules: str | None = None, num_warmup_steps: int | None = None, num_training_steps: int | None = None, num_cycles: int = 1, power: float = 1.0, min_lr_ratio: float = 0.1, last_epoch: int = -1) -> LambdaLR
Unified API to get any scheduler from its name.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
name
|
`str` or `SchedulerType`
|
The name of the scheduler to use. |
required |
optimizer
|
`torch.optim.Optimizer`
|
The optimizer that will be used during training. |
required |
step_rules
|
`str`, *optional*
|
A string representing the step rules to use. This is only used by the |
None
|
num_warmup_steps
|
`int`, *optional*
|
The number of warmup steps to do. This is not required by all schedulers (hence the argument being optional), the function will raise an error if it's unset and the scheduler type requires it. |
None
|
num_training_steps
|
`int``, *optional*
|
The number of training steps to do. This is not required by all schedulers (hence the argument being optional), the function will raise an error if it's unset and the scheduler type requires it. |
None
|
num_cycles
|
`int`, *optional*
|
The number of hard restarts used in |
1
|
power
|
`float`, *optional*, defaults to 1.0
|
Power factor. See |
1.0
|
min_lr_ratio
|
`float`, *optional*, defaults to 0.1
|
The ratio of minimum learning rate to initial learning rate. Used in |
0.1
|
last_epoch
|
`int`, *optional*, defaults to -1
|
The index of the last epoch when resuming training. |
-1
|
Source code in fastvideo/training/training_utils.py
1514 1515 1516 1517 1518 1519 1520 1521 1522 1523 1524 1525 1526 1527 1528 1529 1530 1531 1532 1533 1534 1535 1536 1537 1538 1539 1540 1541 1542 1543 1544 1545 1546 1547 1548 1549 1550 1551 1552 1553 1554 1555 1556 1557 1558 1559 1560 1561 1562 1563 1564 1565 1566 1567 1568 1569 1570 1571 1572 1573 1574 1575 1576 1577 1578 1579 1580 1581 1582 1583 1584 1585 1586 1587 1588 1589 1590 1591 1592 1593 1594 1595 1596 1597 1598 1599 1600 1601 1602 1603 1604 1605 1606 1607 | |
fastvideo.training.training_utils.load_checkpoint
¶
load_checkpoint(transformer, rank, checkpoint_path, optimizer=None, dataloader=None, scheduler=None, noise_generator=None) -> int
Load checkpoint following finetrainer's distributed checkpoint approach. Returns the step number from which training should resume.
Source code in fastvideo/training/training_utils.py
fastvideo.training.training_utils.load_distillation_checkpoint
¶
load_distillation_checkpoint(generator_transformer, fake_score_transformer, rank, checkpoint_path, generator_optimizer=None, fake_score_optimizer=None, dataloader=None, generator_scheduler=None, fake_score_scheduler=None, noise_generator=None, generator_ema=None, generator_transformer_2=None, real_score_transformer_2=None, fake_score_transformer_2=None, generator_optimizer_2=None, fake_score_optimizer_2=None, generator_scheduler_2=None, fake_score_scheduler_2=None, generator_ema_2=None) -> int
Load distillation checkpoint with both generator and fake_score models. Supports MoE (Mixture of Experts) models with transformer_2 variants. Returns the step number from which training should resume.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
generator_transformer
|
Main generator transformer model |
required | |
fake_score_transformer
|
Main fake score transformer model |
required | |
generator_transformer_2
|
Secondary generator transformer for MoE (optional) |
None
|
|
real_score_transformer_2
|
Secondary real score transformer for MoE (optional) |
None
|
|
fake_score_transformer_2
|
Secondary fake score transformer for MoE (optional) |
None
|
|
generator_optimizer_2
|
Optimizer for generator_transformer_2 (optional) |
None
|
|
fake_score_optimizer_2
|
Optimizer for fake_score_transformer_2 (optional) |
None
|
|
generator_scheduler_2
|
Scheduler for generator_transformer_2 (optional) |
None
|
|
fake_score_scheduler_2
|
Scheduler for fake_score_transformer_2 (optional) |
None
|
|
generator_ema_2
|
EMA for generator_transformer_2 (optional) |
None
|
Source code in fastvideo/training/training_utils.py
557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 | |
fastvideo.training.training_utils.save_checkpoint
¶
save_checkpoint(transformer, rank, output_dir, step, optimizer=None, dataloader=None, scheduler=None, noise_generator=None) -> None
Save checkpoint following finetrainer's distributed checkpoint approach. Saves both distributed checkpoint and consolidated model weights.
Source code in fastvideo/training/training_utils.py
fastvideo.training.training_utils.save_distillation_checkpoint
¶
save_distillation_checkpoint(generator_transformer, fake_score_transformer, rank, output_dir, step, generator_optimizer=None, fake_score_optimizer=None, dataloader=None, generator_scheduler=None, fake_score_scheduler=None, noise_generator=None, generator_ema=None, only_save_generator_weight=False, generator_transformer_2=None, real_score_transformer_2=None, fake_score_transformer_2=None, generator_optimizer_2=None, fake_score_optimizer_2=None, generator_scheduler_2=None, fake_score_scheduler_2=None, generator_ema_2=None) -> None
Save distillation checkpoint with both generator and fake_score models. Supports MoE (Mixture of Experts) models with transformer_2 variants. Saves both distributed checkpoint and consolidated model weights. Only saves the generator model for inference (consolidated weights).
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
generator_transformer
|
Main generator transformer model |
required | |
fake_score_transformer
|
Main fake score transformer model |
required | |
only_save_generator_weight
|
If True, only save the generator model weights for inference without saving distributed checkpoint for training resume. |
False
|
|
generator_transformer_2
|
Secondary generator transformer for MoE (optional) |
None
|
|
real_score_transformer_2
|
Secondary real score transformer for MoE (optional) |
None
|
|
fake_score_transformer_2
|
Secondary fake score transformer for MoE (optional) |
None
|
|
generator_optimizer_2
|
Optimizer for generator_transformer_2 (optional) |
None
|
|
fake_score_optimizer_2
|
Optimizer for fake_score_transformer_2 (optional) |
None
|
|
generator_scheduler_2
|
Scheduler for generator_transformer_2 (optional) |
None
|
|
fake_score_scheduler_2
|
Scheduler for fake_score_transformer_2 (optional) |
None
|
|
generator_ema_2
|
EMA for generator_transformer_2 (optional) |
None
|
Source code in fastvideo/training/training_utils.py
194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 | |
fastvideo.training.wan_distillation_pipeline
¶
Classes¶
fastvideo.training.wan_distillation_pipeline.WanDistillationPipeline
¶
WanDistillationPipeline(model_path: str, fastvideo_args: TrainingArgs, required_config_modules: list[str] | None = None, loaded_modules: dict[str, Module] | None = None)
Bases: DistillationPipeline
A distillation pipeline for Wan that uses a single transformer model. The main transformer serves as the student model, and copies are made for teacher and critic.
Source code in fastvideo/training/training_pipeline.py
Functions¶
fastvideo.training.wan_distillation_pipeline.WanDistillationPipeline.create_training_stages
¶create_training_stages(training_args: TrainingArgs)
fastvideo.training.wan_distillation_pipeline.WanDistillationPipeline.initialize_pipeline
¶initialize_pipeline(fastvideo_args: FastVideoArgs)
Initialize Wan-specific scheduler.
Functions¶
fastvideo.training.wan_i2v_distillation_pipeline
¶
Classes¶
fastvideo.training.wan_i2v_distillation_pipeline.WanI2VDistillationPipeline
¶
WanI2VDistillationPipeline(model_path: str, fastvideo_args: TrainingArgs, required_config_modules: list[str] | None = None, loaded_modules: dict[str, Module] | None = None)
Bases: DistillationPipeline
A distillation pipeline for Wan that uses a single transformer model. The main transformer serves as the student model, and copies are made for teacher and critic.
Source code in fastvideo/training/training_pipeline.py
Functions¶
fastvideo.training.wan_i2v_distillation_pipeline.WanI2VDistillationPipeline.create_training_stages
¶create_training_stages(training_args: TrainingArgs)
fastvideo.training.wan_i2v_distillation_pipeline.WanI2VDistillationPipeline.initialize_pipeline
¶initialize_pipeline(fastvideo_args: FastVideoArgs)
Initialize Wan-specific scheduler.
Functions¶
fastvideo.training.wan_i2v_training_pipeline
¶
Classes¶
fastvideo.training.wan_i2v_training_pipeline.WanI2VTrainingPipeline
¶
WanI2VTrainingPipeline(model_path: str, fastvideo_args: TrainingArgs, required_config_modules: list[str] | None = None, loaded_modules: dict[str, Module] | None = None)
Bases: TrainingPipeline
A training pipeline for Wan.
Source code in fastvideo/training/training_pipeline.py
Functions¶
fastvideo.training.wan_i2v_training_pipeline.WanI2VTrainingPipeline.create_training_stages
¶create_training_stages(training_args: TrainingArgs)
Functions¶
fastvideo.training.wan_self_forcing_distillation_pipeline
¶
Classes¶
fastvideo.training.wan_self_forcing_distillation_pipeline.WanSelfForcingDistillationPipeline
¶
WanSelfForcingDistillationPipeline(model_path: str, fastvideo_args: TrainingArgs, required_config_modules: list[str] | None = None, loaded_modules: dict[str, Module] | None = None)
Bases: SelfForcingDistillationPipeline
A self-forcing distillation pipeline for Wan that uses the self-forcing methodology with DMD for video generation.
Source code in fastvideo/training/training_pipeline.py
Functions¶
fastvideo.training.wan_self_forcing_distillation_pipeline.WanSelfForcingDistillationPipeline.create_training_stages
¶create_training_stages(training_args: TrainingArgs)
Functions¶
fastvideo.training.wan_training_pipeline
¶
Classes¶
fastvideo.training.wan_training_pipeline.WanTrainingPipeline
¶
WanTrainingPipeline(model_path: str, fastvideo_args: TrainingArgs, required_config_modules: list[str] | None = None, loaded_modules: dict[str, Module] | None = None)
Bases: TrainingPipeline
A training pipeline for Wan.
Source code in fastvideo/training/training_pipeline.py
Functions¶
fastvideo.training.wan_training_pipeline.WanTrainingPipeline.create_training_stages
¶create_training_stages(training_args: TrainingArgs)