{"id":19134149,"url":"https://github.com/um-arm-lab/efficient-eng-2-ltl","last_synced_at":"2025-05-06T19:27:51.071Z","repository":{"id":174339049,"uuid":"537180648","full_name":"UM-ARM-Lab/Efficient-Eng-2-LTL","owner":"UM-ARM-Lab","description":"The associated repo for paper \"Data-Efficient Learning of Natural Language to Linear Temporal Logic Translators for Robot Task Specification\"","archived":false,"fork":false,"pushed_at":"2023-08-16T05:02:43.000Z","size":1984,"stargazers_count":24,"open_issues_count":0,"forks_count":1,"subscribers_count":10,"default_branch":"main","last_synced_at":"2025-05-06T19:27:45.843Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://um-arm-lab.github.io/Efficient-Eng-2-LTL/","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/UM-ARM-Lab.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,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-15T19:37:58.000Z","updated_at":"2025-02-19T16:34:50.000Z","dependencies_parsed_at":null,"dependency_job_id":"d50f155b-7b38-4e3e-9f53-b80a6c63a51e","html_url":"https://github.com/UM-ARM-Lab/Efficient-Eng-2-LTL","commit_stats":null,"previous_names":["um-arm-lab/efficient-eng-2-ltl"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UM-ARM-Lab%2FEfficient-Eng-2-LTL","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UM-ARM-Lab%2FEfficient-Eng-2-LTL/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UM-ARM-Lab%2FEfficient-Eng-2-LTL/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/UM-ARM-Lab%2FEfficient-Eng-2-LTL/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/UM-ARM-Lab","download_url":"https://codeload.github.com/UM-ARM-Lab/Efficient-Eng-2-LTL/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252752190,"owners_count":21798747,"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":[],"created_at":"2024-11-09T06:25:40.439Z","updated_at":"2025-05-06T19:27:51.048Z","avatar_url":"https://github.com/UM-ARM-Lab.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Data-Efficient Learning of Natural Language to Linear Temporal Logic Translators for Robot Task Specification\n\n![Demo](https://i.imgur.com/ynNTrpf.png)\n\n[[Homepage](https://um-arm-lab.github.io/Efficient-Eng-2-LTL/)] [[Paper](https://arxiv.org/abs/2303.08006)] [[Video](https://drive.google.com/file/d/14Sy5y76YglZ6X3Y3ZZBZZiMGBA9gME9G/view?usp=sharing)] [[Poster](https://drive.google.com/file/d/1j0aZoROb1EKC0oRYYBSwBIx4Xp8ElowN/view?usp=sharing)]\n\n\u003e The associated repo for paper \"Data-Efficient Learning of Natural Language to Linear Temporal Logic Translators for Robot Task Specification\".\n\n## Repo Structure\n\n- Root\n  - datasets\n    - [drone-planning](https://arxiv.org/abs/1905.12096)\n    - [clean-up](http://www.roboticsproceedings.org/rss14/p67.html)\n    - [pick-and-place](http://www.roboticsproceedings.org/rss14/p67.html)\n  - augmentation\n    - paraphrase with GPT-3\n  - run\n    - train the models\n    - inference with constrained decoding\n\nThe constrained decoding inference code is based on: [microsoft/semantic_parsing_with_constrained_lm](https://github.com/microsoft/semantic_parsing_with_constrained_lm)\n\n## Reproduce the Results\n\nFollowing are the instructions for reproducing the result for our model. For baselines, come and check out [this link](https://github.com/UM-ARM-Lab/Efficient-Eng-2-LTL/issues/1).\n### Environment Setup\n\nInstall the dependencies:\n\n```bash\npip install torch torchvision torchaudio --extra-index-url https://download.pytorch.org/whl/cu113 # make sure the version is compatible with your cuda version\npip install transformers datasets\npip install sentencepiece\npip install jsons appdirs blobfile cached-property httpx  typer whoosh more_itertools\npip install --upgrade protobuf==3.20.0\n```\n\nDownload BART-large model:\n\n```bash\ncd ./run\npython ./semantic_parsing_with_constrained_lm/finetune/download_huggingface_lms.py\n```\n\n### Prepare the Dataset\n\nThe processed dataset (with augmentation from LLM) in already included in the repo. This step is only needed if you want to reprocess the dataset.\n\nTo actually process the raw dataset, you can follow the steps below:\n\n1. Pre-process: In each of the three dataset folders, run all cells in \"preprocess.ipynb\" to generate the processed dataset. （the annotation result is included in the notebook).\n2. Augmentation: For each of the three datasets, run all commands in \"augment.ipynb\" to generate the augmented dataset. Note that this step requires a GPT-3 API key.\n3. Move to training folder: You then need to reformat the dataset and move it to the `run/semantic_parsing_with_constrained_lm/domains/ltl/data` folder. A script will be provided later to help you automate this process.\n\n### Train\n\nIn our paper, we use the [BART-large model](https://huggingface.co/facebook/bart-large) because it is efficient to fine-tune on a single GPU. Our proposed method can be easily applied to other potentially stronger language models like [T5-XXL](https://arxiv.org/abs/1910.10683) or [GPT-3](https://arxiv.org/abs/2005.14165).\n\n```sh\nexport PRETRAINED_MODEL_DIR=huggingface_models/bart-large\nexport TRAINED_MODEL_DIR=trained_models/\n\ncd ./run\nDOMAIN=TODO # for example, DOMAIN=pick-syn-aug\npython -m semantic_parsing_with_constrained_lm.finetune.lm_finetune \\\n        --config-name semantic_parsing_with_constrained_lm.finetune.configs.emnlp_train_config \\\n        --exp-names ltl_${DOMAIN}_utterance\n```\n\nHere DOMAIN determines which experiment to run.\nDOMAIN: {dataset_name}-{experiment_name}\n\n- dataset_name: {drone, cleanup, pick}\n- experiment_name:\n  - syn-aug: synthetic with augmentation\n  - syn: synthetic without augmentation\n  - golden-cross0-split{0,1,2,3,4}: golden dataset with cross-validation\n\n### Inference\n\n```sh\nexport PRETRAINED_MODEL_DIR=huggingface_models/bart-large\nexport TRAINED_MODEL_DIR=trained_models/\n\nDOMAIN=TODO\n\npython -m semantic_parsing_with_constrained_lm.run_exp \\\n--config-name semantic_parsing_with_constrained_lm.configs.ltl_config \\\n--log-dir logs/ \\\n--model Bart \\\n--eval-split test-full \\\n--exp-names \"ltl_Bart_test-full_${DOMAIN}_constrained_utterance_train-0\"\n```\n\nThe domain name is the same as the training step.\n\n## Cite\n```bibtex\n@article{pan2023data,\n  title={Data-Efficient Learning of Natural Language to Linear Temporal Logic Translators for Robot Task Specification},\n  author={Pan, Jiayi and Chou, Glen and Berenson, Dmitry},\n  journal={arXiv preprint arXiv:2303.08006},\n  year={2023}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fum-arm-lab%2Fefficient-eng-2-ltl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fum-arm-lab%2Fefficient-eng-2-ltl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fum-arm-lab%2Fefficient-eng-2-ltl/lists"}