Code for our paper: All in One: An Empirical Study of GPT for Few-Shot Aspect-Based Sentiment Anlaysis
- Python 3.9
- PyTorch 1.12
- transformers
- openai
- tqdm
- Train a suitable model to generate candidates for the corresponding dataset as required by dual-encoder4aste;
- Please note that this step can be skipped, we have already generated suitable candidates in datasets.
- You can train the model using the corresponding .sh file ./run_with_ChatGPT.sh, ./run_with_GPTJ.sh or ./run_with_ERNIE.sh
- For example:
bash ./run_with_ChatGPT.sh
- Note: When using the GPT model, please add the correct openai.api_key and openai.api_base in ./model/model.py;
- Note:When using the ERNIE model, please add the correct API_KEY and SECRET_KEY in ./model/model.py.