{"id":31211491,"url":"https://github.com/cyberagentailab/flex-dm","last_synced_at":"2025-09-21T05:27:25.487Z","repository":{"id":151727218,"uuid":"620859962","full_name":"CyberAgentAILab/flex-dm","owner":"CyberAgentAILab","description":"[CVPR 2023 highlight] Towards Flexible Multi-modal Document Models","archived":false,"fork":false,"pushed_at":"2023-09-07T05:20:20.000Z","size":12224,"stargazers_count":59,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-09-10T07:42:52.959Z","etag":null,"topics":["cvpr2023","generative-ai","tensorflow"],"latest_commit_sha":null,"homepage":"https://cyberagentailab.github.io/flex-dm","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/CyberAgentAILab.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2023-03-29T14:09:48.000Z","updated_at":"2025-07-21T08:00:47.000Z","dependencies_parsed_at":"2023-09-09T02:08:02.069Z","dependency_job_id":null,"html_url":"https://github.com/CyberAgentAILab/flex-dm","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/CyberAgentAILab/flex-dm","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberAgentAILab%2Fflex-dm","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberAgentAILab%2Fflex-dm/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberAgentAILab%2Fflex-dm/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberAgentAILab%2Fflex-dm/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/CyberAgentAILab","download_url":"https://codeload.github.com/CyberAgentAILab/flex-dm/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/CyberAgentAILab%2Fflex-dm/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":276195622,"owners_count":25601151,"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","status":"online","status_checked_at":"2025-09-21T02:00:07.055Z","response_time":72,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"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":["cvpr2023","generative-ai","tensorflow"],"created_at":"2025-09-21T05:27:22.977Z","updated_at":"2025-09-21T05:27:25.472Z","avatar_url":"https://github.com/CyberAgentAILab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Towards Flexible Multi-modal Document Models (CVPR2023)\nThis repository is an official implementation of the paper titled above. Please refer to [project page](https://cyberagentailab.github.io/flex-dm/) or [paper](https://arxiv.org/abs/2303.18248) for more details.\n\n## Setup\n\n### Requirements\nWe check the reproducibility under this environment.\n- Python3.7\n- CUDA 11.3\n- Tensorflow 2.8\n\n### How to install\nInstall python dependencies. Perhaps this should be done inside `venv`.\n\n```bash\npip install -r requirements.txt\n```\n\nNote that Tensorflow has a version-specific system requirement for GPU environment.\nCheck if the\n[compatible CUDA/CuDNN runtime](https://www.tensorflow.org/install/source#gpu) is installed.\n\n\n## Crello experiments\nTo try demo on pre-trained models\n- download pre-processed datasets for [crello](https://storage.googleapis.com/ailab-public/flexdm/preprocessed_data/crello.zip) / [rico](https://storage.googleapis.com/ailab-public/flexdm/preprocessed_data/rico.zip) and unzip it under `./data`.\n- download pre-trained checkpointsfor [crello](https://storage.googleapis.com/ailab-public/flexdm/pretrained_weights/crello.zip) / [rico](https://storage.googleapis.com/ailab-public/flexdm/pretrained_weights/rico.zip) and unzip it under `./results`.\n\n### DEMO\nYou can test some tasks using the pre-trained models in the [notebook](./notebooks/demo_crello.ipynb).\n\n### Training\nYou can train your own model.\nThe trainer script takes a few arguments to control hyperparameters.\nSee `src/mfp/mfp/args.py` for the list of available options.\nIf the script slows an out-of-memory error, please make sure other processes do not occupy GPU memory and adjust `--batch_size`.\n\n```bash\nbin/train_mfp.sh crello --masking_method random  # Ours-IMP\nbin/train_mfp.sh crello --masking_method elem_pos_attr_img_txt  # Ours-EXP\nbin/train_mfp.sh crello --masking_method elem_pos_attr_img_txt --weights \u003cWEIGHTS\u003e   # Ours-EXP-FT\n```\n\nThe trainer outputs logs, evaluation results, and checkpoints to `tmp/mfp/jobs/\u003cjob_id\u003e`.\nThe training progress can be monitored via `tensorboard`.\n\n### Evaluation\nYou perform quantitative evaluation.\n```bash\nbin/eval_mfp.sh --job_dir \u003cJOB_DIR\u003e (\u003cADDITIONAL_ARGS\u003e)\n```\nSee [eval.py](https://github.com/CyberAgentAILab/flex-dm/blob/main/eval.py#L122-L134) for `\u003cADDITIONAL_ARGS\u003e`.\n\n## RICO experiments\n\n### DEMO\nYou can test some tasks using the pre-trained models in the [notebook](./notebooks/demo_rico.ipynb).\n\n### Training\nThe process is almost similar as above.\n```bash\nbin/train_mfp.sh rico --masking_method random  # Ours-IMP\nbin/train_mfp.sh rico --masking_method elem_pos_attr  # Ours-EXP\nbin/train_mfp.sh rico --masking_method elem_pos_attr --weights \u003cWEIGHTS\u003e  # Ours-EXP-FT\n```\n\n### Evaluation\nThe process is similar as above.\n\n## Citation\n\nIf you find this code useful for your research, please cite our paper.\n\n```\n@inproceedings{inoue2023document,\n    title={{Towards Flexible Multi-modal Document Models}},\n    author={Naoto Inoue and Kotaro Kikuchi and Edgar Simo-Serra and Mayu Otani and Kota Yamaguchi},\n    booktitle={Proceedings of the IEEE/CVF Conference on Computer Vision and Pattern Recognition (CVPR)},\n    year={2023},\n    pages={14287-14296},\n  }\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyberagentailab%2Fflex-dm","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fcyberagentailab%2Fflex-dm","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fcyberagentailab%2Fflex-dm/lists"}