https://github.com/aise-tudelft/capybara-bint5

Replication package for the SANER 2023 paper titled "Extending Source Code Pre-Trained Language Models to Summarise Decompiled Binaries"

https://github.com/aise-tudelft/capybara-bint5

Science Score: 23.0%

This score indicates how likely this project is to be science-related based on various indicators:

  • CITATION.cff file
  • codemeta.json file
    Found codemeta.json file
  • .zenodo.json file
  • DOI references
  • Academic publication links
    Links to: arxiv.org, zenodo.org
  • Academic email domains
  • Institutional organization owner
  • JOSS paper metadata
  • Scientific vocabulary similarity
    Low similarity (13.3%) to scientific vocabulary
Last synced: 10 months ago · JSON representation

Repository

Replication package for the SANER 2023 paper titled "Extending Source Code Pre-Trained Language Models to Summarise Decompiled Binaries"

Basic Info
  • Host: GitHub
  • Owner: AISE-TUDelft
  • Language: Shell
  • Default Branch: main
  • Size: 42 KB
Statistics
  • Stars: 16
  • Watchers: 1
  • Forks: 1
  • Open Issues: 0
  • Releases: 0
Created over 3 years ago · Last pushed about 2 years ago
Metadata Files
Readme

README.md

Capybara-BinT5

Static Badge Static Badge Docker Image Size (tag) arXiv License

Replication package for the SANER 2023 paper titled "Extending Source Code Pre-Trained Language Models to Summarise Decompiled Binaries".

For questions about the content of this repo, please use the issues board. If you have any questions about the paper, please email the first author.

HuggingFace 🤗

The models and dataset are both also available on the HF Hub.

To replicate the experimental setup of the paper follow the following steps:

Docker Image

It is recommended to use the provided Docker image, which has the correct Cuda version and all of the required dependencies installed. Pull the image, create a container, and mount this folder as a volume:

bash docker pull aalkaswan/bint5 docker run -i -t --name {containerName} --gpus all -v $(pwd):/data aalkaswan/bint5 /bin/bash

This should spawn a shell, which allows you to use the container. Change to the mounted volume: bash cd /data/

All of the following commands should then be run from within the Docker container. You can respawn the shell using:

bash docker exec -it {containerName} /bin/bash

If you wish to run without using docker, we also provide a requirements.txt file.

Setup

First, clone the CodeT5 repo into this directory:

bash git clone https://github.com/salesforce/CodeT5.git

Run the following command to set the correct working directory in the training script:

bash wdir=\WORKDIR=\"`pwd`/'CodeT5/CodeT5'\" && sed -i '1 s#^.*$#'$wdir'#' CodeT5/CodeT5/sh/exp_with_args.sh

Now that the model is set up we need to download the data, use the following commands to download and unpack the data: bash wget https://zenodo.org/record/7229809/files/Capybara.zip unzip Capybara.zip rm Capybara.zip Similarly to download the pretrained BinT5 checkpoints: bash wget https://zenodo.org/records/7229913/files/BinT5.zip?download=1 unzip BinT5.zip rm Capybara.zip

Finetune Models

To use this data in BinT5, setup the data folders in the CodeT5 project: bash mkdir -p CodeT5/CodeT5/data/summarize/{C,decomC,demiStripped,strippedDecomC} Now you can simply move the data of your choice from \Capybara\training_data\{lan}\{dup/dedup} to CodeT5\data\summarize\{lan}. In the downloaded CodeT5 repo change this line and add the languages to the subtask list. Finally, edit the language variable in the job.sh file and start training in detached mode:

bash docker exec -d {containerName} /bin/bash "/data/job.sh"

You can view the progress and results of the finetuning in the: \CodeT5\sh\log.txt file, the resulting model and training outputs are also present in the same folder.

Use Finetuned BinT5 Checkpoints

For each of the models, a pytorch.bin file is provided in its respective folder. These models can be loaded into CodeT5 and used for inference or further training.

To utilise the models, download the reference CodeT5-base model from HuggingFace: bash GIT_LFS_SKIP_SMUDGE=1 git clone https://huggingface.co/Salesforce/codet5-base

  • This will pull the repo but skip the pytorch_model.bin file, which will be replaced in the next step.
  • Select the model that you wish to use from the respective directory. Copy this file and replace the pytorch_model.bin in the local codet5-base directory downloaded in the previous step.
  • Instead of loading in the model through HuggingFace, load in a local model. To load a local model, change line 66 in the sh/exp_with_args.sh file to the path of your local codet5-base model which you downloaded and configured in the previous step. The tokenizer does not need to be replaced.
  • The model can now be run by executing sh/run_exp.py

Owner

  • Name: AISE-TUDelft
  • Login: AISE-TUDelft
  • Kind: organization

GitHub Events

Total
  • Issues event: 2
  • Watch event: 3
Last Year
  • Issues event: 2
  • Watch event: 3

Issues and Pull Requests

Last synced: 10 months ago

All Time
  • Total issues: 5
  • Total pull requests: 8
  • Average time to close issues: about 1 month
  • Average time to close pull requests: 1 minute
  • Total issue authors: 3
  • Total pull request authors: 2
  • Average comments per issue: 2.0
  • Average comments per pull request: 0.0
  • Merged pull requests: 8
  • Bot issues: 0
  • Bot pull requests: 6
Past Year
  • Issues: 1
  • Pull requests: 0
  • Average time to close issues: 4 days
  • Average time to close pull requests: N/A
  • Issue authors: 1
  • Pull request authors: 0
  • Average comments per issue: 0.0
  • Average comments per pull request: 0
  • Merged pull requests: 0
  • Bot issues: 0
  • Bot pull requests: 0
Top Authors
Issue Authors
  • wtegge2 (2)
  • ljk419511 (2)
  • ZJU-Rain (1)
Pull Request Authors
  • dependabot[bot] (6)
  • aalkaswan (2)
Top Labels
Issue Labels
Pull Request Labels
dependencies (6) documentation (2)

Dependencies

requirements.txt pypi
  • Jinja2 ==3.1.2
  • Markdown ==3.3.6
  • MarkupSafe ==2.1.1
  • Pillow ==9.3.0
  • PyYAML ==6.0
  • Pygments ==2.13.0
  • QtPy ==2.2.0
  • Send2Trash ==1.8.0
  • Werkzeug ==2.0.3
  • absl-py ==1.0.0
  • argon2-cffi ==21.3.0
  • argon2-cffi-bindings ==21.2.0
  • asttokens ==2.0.8
  • attrs ==22.1.0
  • backcall ==0.2.0
  • beautifulsoup4 ==4.11.1
  • bleach ==5.0.1
  • cachetools ==5.0.0
  • certifi ==2022.12.7
  • cffi ==1.15.1
  • charset-normalizer ==2.0.12
  • click ==8.0.4
  • commonmark ==0.9.1
  • debugpy ==1.6.3
  • decorator ==5.1.1
  • defusedxml ==0.7.1
  • entrypoints ==0.4
  • executing ==1.0.0
  • fastjsonschema ==2.16.1
  • filelock ==3.6.0
  • google-auth ==2.6.0
  • google-auth-oauthlib ==0.4.6
  • gpg ===1.13.1
  • grpcio ==1.44.0
  • huggingface-hub ==0.4.0
  • idna ==3.3
  • importlib-metadata ==4.11.1
  • importlib-resources ==5.9.0
  • ipykernel ==6.15.2
  • ipython ==8.4.0
  • ipython-genutils ==0.2.0
  • ipywidgets ==8.0.1
  • jedi ==0.18.1
  • joblib ==1.2.0
  • jsonschema ==4.15.0
  • jupyter ==1.0.0
  • jupyter-client ==7.3.5
  • jupyter-console ==6.4.4
  • jupyter-core ==4.11.2
  • jupyterlab-pygments ==0.2.2
  • jupyterlab-widgets ==3.0.2
  • kernel-driver ==0.0.7
  • lxml ==4.9.1
  • matplotlib-inline ==0.1.6
  • mistune ==2.0.4
  • nbclient ==0.6.7
  • nbconvert ==7.0.0
  • nbformat ==5.4.0
  • nbterm ==0.0.13
  • nest-asyncio ==1.5.5
  • notebook ==6.4.12
  • numpy ==1.22.2
  • oauthlib ==3.2.1
  • packaging ==21.3
  • pandocfilters ==1.5.0
  • parso ==0.8.3
  • pexpect ==4.8.0
  • pickleshare ==0.7.5
  • pkgutil-resolve-name ==1.3.10
  • prometheus-client ==0.14.1
  • prompt-toolkit ==3.0.30
  • protobuf ==3.19.5
  • psutil ==5.9.1
  • ptyprocess ==0.7.0
  • pure-eval ==0.2.2
  • pyasn1 ==0.4.8
  • pyasn1-modules ==0.2.8
  • pycparser ==2.21
  • pycrypto ==2.6.1
  • pyparsing ==3.0.7
  • pyrsistent ==0.18.1
  • python-dateutil ==2.8.2
  • pyzmq ==23.2.1
  • qtconsole ==5.3.2
  • regex ==2022.1.18
  • requests ==2.27.1
  • requests-oauthlib ==1.3.1
  • rich ==12.5.1
  • rsa ==4.8
  • sacremoses ==0.0.47
  • six ==1.16.0
  • soupsieve ==2.3.2.post1
  • stack-data ==0.5.0
  • tensorboard ==2.8.0
  • tensorboard-data-server ==0.6.1
  • tensorboard-plugin-wit ==1.8.1
  • terminado ==0.15.0
  • tinycss2 ==1.1.1
  • tokenizers ==0.11.5
  • torch ==1.13.1
  • torchaudio ==0.9.0
  • torchvision ==0.10.0
  • tornado ==6.2
  • tqdm ==4.62.3
  • traitlets ==5.3.0
  • transformers ==4.16.2
  • tree-sitter ==0.20.0
  • typer ==0.6.1
  • typing-extensions ==4.1.1
  • urllib3 ==1.26.8
  • wcwidth ==0.2.5
  • webencodings ==0.5.1
  • widgetsnbextension ==4.0.2
  • xeus-python ==0.14.3
  • xeus-python-shell ==0.5.0
  • zipp ==3.7.0