| 1057 | # time ids |
| 1058 | |
| 1059 | def compute_time_ids(): |
| 1060 | # Adapted from pipeline.StableDiffusionXLPipeline._get_add_time_ids |
| 1061 | original_size = (args.resolution, args.resolution) |
| 1062 | target_size = (args.resolution, args.resolution) |
| 1063 | crops_coords_top_left = (args.crops_coords_top_left_h, args.crops_coords_top_left_w) |
| 1064 | add_time_ids = list(original_size + crops_coords_top_left + target_size) |
| 1065 | add_time_ids = torch.tensor([add_time_ids]) |
| 1066 | add_time_ids = add_time_ids.to(accelerator.device, dtype=weight_dtype) |
| 1067 | return add_time_ids |
| 1068 | |
| 1069 | if not args.train_text_encoder and args.modifier_token is None: |
| 1070 | tokenizers = [tokenizer_one, tokenizer_two] |