https://github.com/xingyaoww/code4struct
Official repo for ACL 2023 paper Code4Struct: Code Generation for Few-Shot Structured Prediction from Natural Language.
https://github.com/xingyaoww/code4struct
Last synced: 27 days ago
JSON representation
Official repo for ACL 2023 paper Code4Struct: Code Generation for Few-Shot Structured Prediction from Natural Language.
- Host: GitHub
- URL: https://github.com/xingyaoww/code4struct
- Owner: xingyaoww
- License: gpl-3.0
- Created: 2022-10-22T03:33:40.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-01-07T02:16:29.000Z (over 1 year ago)
- Last Synced: 2025-02-04T20:12:10.103Z (3 months ago)
- Language: HTML
- Homepage:
- Size: 319 KB
- Stars: 41
- Watchers: 2
- Forks: 1
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Code4Struct: Code Generation for Few-Shot Structured Prediction from Natural Language
Official repo for paper [Code4Struct: Code Generation for Few-Shot Structured Prediction from Natural Language](https://arxiv.org/abs/2210.12810).
## Environment Setup
```
conda env create -f environment.yml
conda activate code4struct
```## Data
Please refer to [docs/DATA.md](docs/DATA.md) for detailed instructions.
## Inference
You will need to obtain your API key from [here](https://beta.openai.com/account/api-keys).
```bash
export OPENAI_API_KEY="YOUR_API_KEY_HERE"
./src/scripts/model/batch-exp.sh
```## Evaluate generated results
```bash
./src/scripts/evaluation/eval-all-ace.sh ACE05-E/codex
```Evaluation result for each experiment run will be saved to the corresponding output_dir (e.g., `data/extraction/ace/inferred/ACE05-E/codex/v6.4-baseline+trigger+hierarchy-50shot-n1-t0.0`).
## Visualize Evaluation Result
You can also visualize evaluation result using `localhost:8000` by running the following:
```bash
streamlit run --server.port 8000 src/scripts/evaluation/streamlit-viz.py
```## Citation
```
@article{wang2022code4struct,
title={Code4Struct: Code Generation for Few-Shot Structured Prediction from Natural Language},
author={Wang, Xingyao and Li, Sha and Ji, Heng},
journal={arXiv preprint arXiv:2210.12810},
year={2022}
}
```