{"about":{"site":"https://codewithpapers.app","non_affiliation":"Code with Papers and Syntology are not affiliated with, endorsed by, or sponsored by Papers with Code, Meta, or the pwc-archive mirror.","licence":"CC BY-SA 4.0","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","attribution":"https://codewithpapers.app/attribution","modified":"archive material modified by Syntology; see the attribution page"},"url":"/paper/instructpix2pix-learning-to-follow-image","title":"InstructPix2Pix: Learning to Follow Image Editing Instructions","arxiv_id":"2211.09800","date":"2022-11-17","proceeding":"CVPR 2023 1","authors":["Tim Brooks","Aleksander Holynski","Alexei A. Efros"],"abstract":"We propose a method for editing images from human instructions: given an input image and a written instruction that tells the model what to do, our model follows these instructions to edit the image. To obtain training data for this problem, we combine the knowledge of two large pretrained models -- a language model (GPT-3) and a text-to-image model (Stable Diffusion) -- to generate a large dataset of image editing examples. Our conditional diffusion model, InstructPix2Pix, is trained on our generated data, and generalizes to real images and user-written instructions at inference time. Since it performs edits in the forward pass and does not require per example fine-tuning or inversion, our model edits images quickly, in a matter of seconds. We show compelling editing results for a diverse collection of input images and written instructions.","url_abs":"https://arxiv.org/abs/2211.09800v2","url_pdf":"https://arxiv.org/pdf/2211.09800v2.pdf","source":{"archive":"pwc-archive (Hugging Face), CC BY-SA 4.0","snapshot":"2025-07-28","licence_url":"https://creativecommons.org/licenses/by-sa/4.0/legalcode","row_kind":"abstracts"},"code_links":[{"paper_slug":"instructpix2pix-learning-to-follow-image","repo_url":"https://github.com/timothybrooks/instruct-pix2pix","is_official":1,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":{"status":"ok","spdx":"NOASSERTION"}},{"paper_slug":"instructpix2pix-learning-to-follow-image","repo_url":"https://github.com/lsl001006/zone","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"instructpix2pix-learning-to-follow-image","repo_url":"https://github.com/mahdip72/InstructPix2Pix","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"instructpix2pix-learning-to-follow-image","repo_url":"https://github.com/mv-lab/InstructIR","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":1,"framework":"pytorch","reach":null},{"paper_slug":"instructpix2pix-learning-to-follow-image","repo_url":"https://github.com/huggingface/diffusers","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"jax","reach":null},{"paper_slug":"instructpix2pix-learning-to-follow-image","repo_url":"https://github.com/xuduo35/InstructPix2Pix","is_official":0,"mentioned_in_paper":0,"mentioned_in_github":0,"framework":"pytorch","reach":{"status":"ok","spdx":"MIT"}}],"tasks":[{"task_slug":"image-editing","task_name":"Image Editing"},{"task_slug":"language-modeling","task_name":"Language Modeling"},{"task_slug":"language-modelling","task_name":"Language Modelling"},{"task_slug":"text-to-image-generation-1","task_name":"Text to Image Generation"},{"task_slug":"text-based-image-editing","task_name":"Text-based Image Editing"}],"methods":[{"method_slug":"diffusion","method_name":"Diffusion"}],"datasets_introduced":[{"slug":"instructpix2pix-image-editing-dataset","name":"InstructPix2Pix Image Editing Dataset","full_name":""}],"methods_introduced":[],"results":[{"leaderboard":"/sota/image-editing-on-imgedit-data","task":"Image Editing","dataset":"ImgEdit-Data","model":"Instruct-Pix2Pix","rank_in_archive_order":8,"of":9,"metrics":{"Action":"1.46","Add":"2.45","Adjust":"1.83","Background":"1.44","Extract":"1.44","Hybrid":"1.2","Overall":"1.88","Remove":"1.50","Replace":"2.01","Style":"3.55"},"uses_additional_data":false}],"syntology":{"atlas_url":"https://app.syntology.ai/?focus=2211.09800","mcp":{"get_harvested_code_for_paper":{"arxiv_id":"2211.09800"}},"developers":"https://syntology.ai/developers","read_at":"2026-09-24T18:15:14+00:00","read_at_is":"when the build read Syntology's graph, not when any sample ran","claim":"Per-sample execution status on synthesized fixtures; not a correctness claim about the paper. Samples come from repositories linked to the paper, official or community; repo_kind says which.","repos":[{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/huggingface/diffusers","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/timothybrooks/instruct-pix2pix","reach":{"status":"ok","spdx":"NOASSERTION"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/lsl001006/zone","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mahdip72/InstructPix2Pix","reach":null},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/xuduo35/InstructPix2Pix","reach":{"status":"ok","spdx":"MIT"}},{"provenance":"external:paperswithcode_snapshot_2025-07-28","url":"https://github.com/mv-lab/InstructIR","reach":null}],"summary":{"ran":5,"ran_draft_wrong":5,"ran_violates":3,"ran_honours":2,"unverified":5},"by_repo_kind":{"listed":{"samples":20,"ran":15,"repositories":4}},"repo_kind_vocabulary":{"official":"The archive marks this repository official for the paper","named_in_paper":"The archive records that the paper mentions this repository; it is not marked official","listed":"In the archive's code links for this paper, not marked official and not recorded as mentioned in the paper","found_in_text":"Syntology found this repository in the paper's own text; whether it is the authors' implementation is not asserted","community":"Not in the archive's code links for this paper; a community repository Syntology harvested"},"n_pointer_only_for_licence":0,"samples":[{"code_sha256_prefix":"da8184593ecc419a","entry":"InstructIR","repo":"mv-lab/InstructIR","repo_kind":"listed","path":"models/instructir.py","file_url":"https://github.com/mv-lab/InstructIR/blob/HEAD/models/instructir.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"da8184593ecc419a"}},{"code_sha256_prefix":"359c5485e870e3e6","entry":"NAFBlock","repo":"mv-lab/InstructIR","repo_kind":"listed","path":"models/instructir.py","file_url":"https://github.com/mv-lab/InstructIR/blob/HEAD/models/instructir.py","link_basis":"first_harvest_node","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":"deterministic","behaviour_fingerprint":true,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"359c5485e870e3e6"}},{"code_sha256_prefix":"569fbf037c75f18b","entry":"adapt_unet_for_pix2pix","repo":"mahdip72/InstructPix2Pix","repo_kind":"listed","path":"instruct_pix2pix/model.py","file_url":"https://github.com/mahdip72/InstructPix2Pix/blob/HEAD/instruct_pix2pix/model.py","link_basis":"first_harvest_node","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"569fbf037c75f18b"}},{"code_sha256_prefix":"fe5dd5258046898c","entry":"always","repo":"xuduo35/InstructPix2Pix","repo_kind":"listed","path":"ldm/modules/x_transformer.py","file_url":"https://github.com/xuduo35/InstructPix2Pix/blob/HEAD/ldm/modules/x_transformer.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"fe5dd5258046898c"}},{"code_sha256_prefix":"8241c0562bc710fd","entry":"chunk","repo":"xuduo35/InstructPix2Pix","repo_kind":"listed","path":"stable_txt2img.py","file_url":"https://github.com/xuduo35/InstructPix2Pix/blob/HEAD/stable_txt2img.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"OUTPUT_MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"8241c0562bc710fd"}},{"code_sha256_prefix":"424012cb37b31172","entry":"default","repo":"xuduo35/InstructPix2Pix","repo_kind":"listed","path":"ldm/modules/attention.py","file_url":"https://github.com/xuduo35/InstructPix2Pix/blob/HEAD/ldm/modules/attention.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"well_formed","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"424012cb37b31172"}},{"code_sha256_prefix":"4cb732f513d69dfd","entry":"disabled_train","repo":"xuduo35/InstructPix2Pix","repo_kind":"listed","path":"ldm/models/diffusion/classifier.py","file_url":"https://github.com/xuduo35/InstructPix2Pix/blob/HEAD/ldm/models/diffusion/classifier.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4cb732f513d69dfd"}},{"code_sha256_prefix":"aa5486a3650902d8","entry":"exists","repo":"xuduo35/InstructPix2Pix","repo_kind":"listed","path":"ldm/modules/attention.py","file_url":"https://github.com/xuduo35/InstructPix2Pix/blob/HEAD/ldm/modules/attention.py","link_basis":"harvester_set","language":"python","status":"ran_violates","verification_level":1,"contract_check":"VIOLATES","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"aa5486a3650902d8"}},{"code_sha256_prefix":"d5726f9e3a5684c3","entry":"get_bert_token_for_string","repo":"xuduo35/InstructPix2Pix","repo_kind":"listed","path":"ldm/modules/embedding_manager.py","file_url":"https://github.com/xuduo35/InstructPix2Pix/blob/HEAD/ldm/modules/embedding_manager.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d5726f9e3a5684c3"}},{"code_sha256_prefix":"41c6eb3a0aa3eb46","entry":"get_clip_token_for_string","repo":"xuduo35/InstructPix2Pix","repo_kind":"listed","path":"ldm/modules/embedding_manager.py","file_url":"https://github.com/xuduo35/InstructPix2Pix/blob/HEAD/ldm/modules/embedding_manager.py","link_basis":"harvester_set","language":"python","status":"ran_honours","verification_level":1,"contract_check":"HONOURS","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"41c6eb3a0aa3eb46"}},{"code_sha256_prefix":"71c2df28a1008d03","entry":"get_embedding_for_clip_token","repo":"xuduo35/InstructPix2Pix","repo_kind":"listed","path":"ldm/modules/embedding_manager.py","file_url":"https://github.com/xuduo35/InstructPix2Pix/blob/HEAD/ldm/modules/embedding_manager.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"71c2df28a1008d03"}},{"code_sha256_prefix":"b1368330cf0f5642","entry":"isimage","repo":"xuduo35/InstructPix2Pix","repo_kind":"listed","path":"ldm/util.py","file_url":"https://github.com/xuduo35/InstructPix2Pix/blob/HEAD/ldm/util.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"b1368330cf0f5642"}},{"code_sha256_prefix":"d72762b700feee6f","entry":"ismap","repo":"xuduo35/InstructPix2Pix","repo_kind":"listed","path":"ldm/util.py","file_url":"https://github.com/xuduo35/InstructPix2Pix/blob/HEAD/ldm/util.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"d72762b700feee6f"}},{"code_sha256_prefix":"f41710299c49d36d","entry":"log_txt_as_img","repo":"xuduo35/InstructPix2Pix","repo_kind":"listed","path":"ldm/util.py","file_url":"https://github.com/xuduo35/InstructPix2Pix/blob/HEAD/ldm/util.py","link_basis":"harvester_set","language":"python","status":"ran","verification_level":1,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"f41710299c49d36d"}},{"code_sha256_prefix":"9a299fe5ae09e407","entry":"uniq","repo":"xuduo35/InstructPix2Pix","repo_kind":"listed","path":"ldm/modules/attention.py","file_url":"https://github.com/xuduo35/InstructPix2Pix/blob/HEAD/ldm/modules/attention.py","link_basis":"harvester_set","language":"python","status":"ran_draft_wrong","verification_level":1,"contract_check":"MISDECLARED","metamorphic_tier":"deterministic","behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9a299fe5ae09e407"}},{"code_sha256_prefix":"4a0143b046f97246","entry":"ICB","repo":"mv-lab/InstructIR","repo_kind":"listed","path":"models/instructir.py","file_url":"https://github.com/mv-lab/InstructIR/blob/HEAD/models/instructir.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"4a0143b046f97246"}},{"code_sha256_prefix":"81aae1af1d3e0807","entry":"center_crop","repo":"xuduo35/InstructPix2Pix","repo_kind":"listed","path":"stable_txt2img.py","file_url":"https://github.com/xuduo35/InstructPix2Pix/blob/HEAD/stable_txt2img.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"81aae1af1d3e0807"}},{"code_sha256_prefix":"9aee358ca7c31dbc","entry":"prune_checkpoint","repo":"xuduo35/InstructPix2Pix","repo_kind":"listed","path":"ldm/pruner.py","file_url":"https://github.com/xuduo35/InstructPix2Pix/blob/HEAD/ldm/pruner.py","link_basis":"harvester_set","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"MIT","inline_ok":true,"mcp_get_code":{"code_sha256":"9aee358ca7c31dbc"}},{"code_sha256_prefix":"48d7b99aa07d02fe","entry":"register_attention_control","repo":"lsl001006/zone","repo_kind":"listed","path":"null_text_w_ptp.py","file_url":"https://github.com/lsl001006/zone/blob/HEAD/null_text_w_ptp.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"48d7b99aa07d02fe"}},{"code_sha256_prefix":"70183cfe0ed40ffb","entry":"text2image_instructpix2pix","repo":"lsl001006/zone","repo_kind":"listed","path":"null_text_w_ptp.py","file_url":"https://github.com/lsl001006/zone/blob/HEAD/null_text_w_ptp.py","link_basis":"first_harvest_node","language":"python","status":"unverified","verification_level":0,"contract_check":null,"metamorphic_tier":null,"behaviour_fingerprint":false,"licence":"Apache-2.0","inline_ok":true,"mcp_get_code":{"code_sha256":"70183cfe0ed40ffb"}}]},"arxiv_metadata":null,"syntology_extracted_results":null}