{"id":13488282,"url":"https://github.com/bahjat-kawar/time-diffusion","last_synced_at":"2025-03-28T00:33:27.006Z","repository":{"id":152530149,"uuid":"612885330","full_name":"bahjat-kawar/time-diffusion","owner":"bahjat-kawar","description":"Official code repo for \"Editing Implicit Assumptions in Text-to-Image Diffusion Models\"","archived":false,"fork":false,"pushed_at":"2023-03-15T16:07:13.000Z","size":802,"stargazers_count":80,"open_issues_count":4,"forks_count":2,"subscribers_count":2,"default_branch":"main","last_synced_at":"2024-10-31T00:36:31.413Z","etag":null,"topics":["diffusion","diffusion-models","knowledge-editing","stable-diffusion","text-to-image","text2image"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bahjat-kawar.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null}},"created_at":"2023-03-12T09:20:40.000Z","updated_at":"2024-10-07T10:24:54.000Z","dependencies_parsed_at":null,"dependency_job_id":"cc8dbbdf-eeb7-43a5-8466-3d817ad3d624","html_url":"https://github.com/bahjat-kawar/time-diffusion","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahjat-kawar%2Ftime-diffusion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahjat-kawar%2Ftime-diffusion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahjat-kawar%2Ftime-diffusion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bahjat-kawar%2Ftime-diffusion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bahjat-kawar","download_url":"https://codeload.github.com/bahjat-kawar/time-diffusion/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":245949254,"owners_count":20698911,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["diffusion","diffusion-models","knowledge-editing","stable-diffusion","text-to-image","text2image"],"created_at":"2024-07-31T18:01:13.007Z","updated_at":"2025-03-28T00:33:21.987Z","avatar_url":"https://github.com/bahjat-kawar.png","language":"Python","funding_links":[],"categories":["T2I Diffusion Model augmentation"],"sub_categories":[],"readme":"# Editing Implicit Assumptions in Text-to-Image Diffusion Models\n\n[arXiv](https://arxiv.org/abs/2303.08084) | [PDF](https://time-diffusion.github.io/TIME_paper.pdf) | [Website](https://time-diffusion.github.io/) | [Gradio Demo](https://huggingface.co/spaces/bahjat-kawar/time-diffusion)\n\n[Hadas Orgad](https://orgadhadas.github.io/)\u003csup\u003e\\*\u003c/sup\u003e, [Bahjat Kawar](https://bahjat-kawar.github.io/)\u003csup\u003e\\*\u003c/sup\u003e, and [Yonatan Belinkov](https://www.cs.technion.ac.il/~belinkov/), Technion.\u003cbr /\u003e\n\u003csup\u003e*\u003c/sup\u003e Equal Contribution.\n\nWe introduce TIME (Text-to-Image Model Editing), a method for editing implicit assumptions in text-to-image diffusion models.\n\n\u003cimg src=\"assets/time-headline.png\" alt=\"time-overview\" style=\"width:800px;\"/\u003e\n\n\u003cb\u003eNew:\u003c/b\u003e Check out the [Gradio demo](https://huggingface.co/spaces/bahjat-kawar/time-diffusion) and edit text-to-image models from your browser!\n\n## Dependencies Setup\n\nThis repo was tested with PyTorch 1.13.1, CUDA 11.6.2, Numpy 1.23.4, and Diffusers 0.9.0.\n\nAn example environment is given in `environment.yml`.\n\n## Running the Experiments\n\nThe general command to apply TIME and see results:\n```\npython apply_time.py {--with_to_k} {--with_augs} --train_func {TRAIN_FUNC} --lamb {LAMBDA} --save_dir {SAVE_DIR} --dataset {DATASET} --begin_idx {BEGIN} --end_idx {END} --num_seeds {SEEDS}\n```\nwhere the following are options\n- `--with_to_k` whether to edit the key projection matrix along with the value projection matrix.\n- `--with_augs` whether to apply textual augmentations for editing.\n- `TRAIN_FUNC` the name of the editing function to use (`train_closed_form` or `baseline`).\n- `LAMBDA` the regularization hyperparameter to be used in `train_closed_form` (default: `0.1`).\n- `SAVE_DIR` the directory name to save into.\n- `DATASET` the dataset csv file name (default: `TIMED_test_set_filtered_SD14.csv`).\n- `BEGIN` the index to begin from in the dataset (inclusive).\n- `END` the index to end on in the dataset (exclusive).\n- `SEEDS` the number of seeds to generate images for in each prompt.\n\nFor example, for applying the main experiment on TIMED presented in the paper:\n```\npython apply_time.py --with_to_k --with_augs --train_func train_closed_form --lamb 0.1 --save_dir results --begin_idx 0 --end_idx 104 --num_seeds 24\n```\n\n## References and Acknowledgements\n```\n@article{orgad2023editing,\n    title={Editing Implicit Assumptions in Text-to-Image Diffusion Models},\n    author={Orgad, Hadas and Kawar, Bahjat and Belinkov, Yonatan},\n    journal={arXiv:2303.08084},\n    year={2023}\n}\n```\n\nThis implementation is inspired by:\n- [Prompt-to-Prompt Repo](https://github.com/google/prompt-to-prompt)\n- [HuggingFace Diffusers](https://github.com/huggingface/diffusers)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahjat-kawar%2Ftime-diffusion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbahjat-kawar%2Ftime-diffusion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbahjat-kawar%2Ftime-diffusion/lists"}