vision_unlearning.utils.training ================================ .. py:module:: vision_unlearning.utils.training Functions --------- .. autoapisummary:: vision_unlearning.utils.training.tokenize_captions vision_unlearning.utils.training.unwrap_model vision_unlearning.utils.training.forget_tokens vision_unlearning.utils.training.preprocess_train vision_unlearning.utils.training.collate_fn vision_unlearning.utils.training.launch_accelerated_training Module Contents --------------- .. py:function:: tokenize_captions(examples, tokenizer, caption_column, is_train=True) Adapted from The HuggingFace Inc. team. All rights reserved. Licensed under the Apache License, Version 2.0. Source: https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image_lora.py .. py:function:: unwrap_model(model, accelerator) Adapted from The HuggingFace Inc. team. All rights reserved. Licensed under the Apache License, Version 2.0. Source: https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image_lora.py .. py:function:: forget_tokens(examples, tokenizer, caption_column, forget_prompt: str) .. py:function:: preprocess_train(examples, tokenizer, caption_column, image_column, train_transforms, overwrite_column: Optional[str] = None, concept_overwrite: Optional[str] = None) Adapted from The HuggingFace Inc. team. All rights reserved. Licensed under the Apache License, Version 2.0. Source: https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image_lora.py concept_overwrite: concept to be used for overwriting, described as an textual string (used to modify the prompt). TODO: this handling of concept_overwrite is weird... I wish this were somewhat more structured/organized/clear. For example, the overwriting string may need a more complex prompt than just "an image of f{concept_overwrite}", or with a different article .. py:function:: collate_fn(examples) Adapted from The HuggingFace Inc. team. All rights reserved. Licensed under the Apache License, Version 2.0. Source: https://github.com/huggingface/diffusers/blob/main/examples/text_to_image/train_text_to_image_lora.py .. py:function:: launch_accelerated_training(unlearner: Unlearner) Wrap your training function with the accelerator