MCPcopy Create free account
hub / github.com/Netflix/void-model / main

Function main

scripts/cogvideox_fun/train.py:728–1915  ·  view source on GitHub ↗
()

Source from the content-addressed store, hash-verified

726
727
728def main():
729 args = parse_args()
730
731 if args.report_to == "wandb" and args.hub_token is not None:
732 raise ValueError(
733 "You cannot use both --report_to=wandb and --hub_token due to a security risk of exposing your token."
734 " Please use `huggingface-cli login` to authenticate with the Hub."
735 )
736
737 if args.non_ema_revision is not None:
738 deprecate(
739 "non_ema_revision!=None",
740 "0.15.0",
741 message=(
742 "Downloading 'non_ema' weights from revision branches of the Hub is deprecated. Please make sure to"
743 " use `--variant=non_ema` instead."
744 ),
745 )
746 logging_dir = os.path.join(args.output_dir, args.logging_dir)
747
748 accelerator_project_config = ProjectConfiguration(project_dir=args.output_dir, logging_dir=logging_dir)
749
750 accelerator = Accelerator(
751 gradient_accumulation_steps=args.gradient_accumulation_steps,
752 mixed_precision=args.mixed_precision,
753 log_with=args.report_to,
754 project_config=accelerator_project_config,
755 )
756 if accelerator.is_main_process:
757 writer = SummaryWriter(log_dir=logging_dir)
758
759 # Make one log on every process with the configuration for debugging.
760 logging.basicConfig(
761 format="%(asctime)s - %(levelname)s - %(name)s - %(message)s",
762 datefmt="%m/%d/%Y %H:%M:%S",
763 level=logging.INFO,
764 )
765 logger.info(accelerator.state, main_process_only=False)
766 if accelerator.is_local_main_process:
767 datasets.utils.logging.set_verbosity_warning()
768 transformers.utils.logging.set_verbosity_warning()
769 diffusers.utils.logging.set_verbosity_info()
770 else:
771 datasets.utils.logging.set_verbosity_error()
772 transformers.utils.logging.set_verbosity_error()
773 diffusers.utils.logging.set_verbosity_error()
774
775 # If passed along, set the training seed now.
776 if args.seed is not None:
777 set_seed(args.seed)
778 rng = np.random.default_rng(np.random.PCG64(args.seed + accelerator.process_index))
779 torch_rng = torch.Generator(accelerator.device).manual_seed(args.seed + accelerator.process_index)
780 else:
781 rng = None
782 torch_rng = None
783 index_rng = np.random.default_rng(np.random.PCG64(43))
784 print(f"Init rng with seed {args.seed + accelerator.process_index}. Process_index is {accelerator.process_index}")
785

Callers 1

train.pyFile · 0.70

Calls 15

ImageVideoDatasetClass · 0.90
RandomSamplerClass · 0.90
ImageVideoSamplerClass · 0.90
DiscreteSamplingClass · 0.90
save_videos_gridFunction · 0.90
save_stateMethod · 0.80
parse_argsFunction · 0.70
_create_special_listFunction · 0.70
_batch_encode_vaeFunction · 0.70

Tested by

no test coverage detected