(model)
| 1134 | |
| 1135 | # Function for unwrapping if model was compiled with `torch.compile`. |
| 1136 | def unwrap_model(model): |
| 1137 | model = accelerator.unwrap_model(model) |
| 1138 | model = model._orig_mod if is_compiled_module(model) else model |
| 1139 | return model |
| 1140 | |
| 1141 | # Train! |
| 1142 | total_batch_size = args.train_batch_size * accelerator.num_processes * args.gradient_accumulation_steps |