This project provides a pipeline to generate code diff patches for fixing issues in repositories from the SWE-Bench-Lite dataset using the LLM model. The pipeline consists of four main scripts:
load_dataset.py: Loads the SWE-Bench-Lite dataset and extracts relevant data.load_codebase.py: Clones the repositories at the specified base commit.extract_input.py: Extracts relevant code snippets for each issue.run_llm_{model_name}.py: Generates code diff patches using the SWE-Llama-7b model.graph TD
A[Load Dataset] --> B[Clone Codebase]
B --> C[Extract Input]
C --> D[Run LLM]
D --> E[Generate Patches]
subgraph Pipeline
A -->|load_dataset.py| B
B -->|load_codebase.py| C
C -->|extract_input.py| D
D -->|run_llm.py| E
end
Clone the repository:
git clone https://github.com/KoYejune0302/bob-swe.git
cd bob-swe
Create a virtual environment:
python -m venv venv
source venv/bin/activate
Install dependencies:
pip install -r requirements.txt
Run the load_dataset.py script to load the SWE-Bench-Lite dataset and extract relevant data:
python load_dataset.py
This generates a JSON file (swe_bench_lite_dev.json) containing the extracted data.
Run the load_codebase.py script to clone the repositories at the specified base commit:
python load_codebase.py
The repositories are saved in the codebase/{instance_id} directory.
Run the extract_input.py script to extract relevant code snippets for each issue:
python extract_input.py
This generates input files (input_data/{instance_id}/input.txt) containing the problem statement and relevant code snippets.
Run the run_llm_{model_name}.py script to generate code diff patches using the SWE-Llama-7b model:
python run_llm_{model_name}.py
This generates a JSON file (model_patches_YYYYMMDD_HHMMSS.json) containing the patches.
pip install sb-cli
Before using the CLI, you'll need to get an API key:
sb-cli gen-api-key your.email@example.com
export SWEBENCH_API_KEY=your_api_key
# or add export SWEBENCH_API_KEY=your_api_key to your .*rc file
sb-cli verify-api-key YOUR_VERIFICATION_CODE
sb-cli submit swe-bench_lite dev --predictions_path {model_patch.json} --run_id {run_id}
sb-cli submit swe-bench_lite test --predictions_path {model_patch.json} --run_id {run_id}
swe_bench_lite_dev.json: Extracted dataset.codebase/{instance_id}: Cloned repositories.input_data/{instance_id}/input.txt: Extracted input for each issue.model_patches_YYYYMMDD_HHMMSS.json: Generated patches.The requirements.txt file contains all the dependencies for the project. Install them using:
pip install -r requirements.txt
DEFAULT_PROMPT_TEMPLATE in prompt.py to customize the prompt for the LLM.princeton-nlp/SWE-Llama-7b in run_llm_swe_llama.py with another model if needed.Missing Dependencies:
pip install -r requirements.txt.pip install tiktoken).GPU Issues:
python -c "import torch; print(torch.cuda.is_available())"
False, ensure CUDA is installed and compatible with your GPU.16 commits
Python
98.7%
Shell
1.3%
This project provides a pipeline to generate code diff patches for fixing issues in repositories from the SWE-Bench-Lite dataset using the LLM model. The pipeline consists of four main scripts:
load_dataset.py: Loads the SWE-Bench-Lite dataset and extracts relevant data.load_codebase.py: Clones the repositories at the specified base commit.extract_input.py: Extracts relevant code snippets for each issue.run_llm_{model_name}.py: Generates code diff patches using the SWE-Llama-7b model.graph TD
A[Load Dataset] --> B[Clone Codebase]
B --> C[Extract Input]
C --> D[Run LLM]
D --> E[Generate Patches]
subgraph Pipeline
A -->|load_dataset.py| B
B -->|load_codebase.py| C
C -->|extract_input.py| D
D -->|run_llm.py| E
end
Clone the repository:
git clone https://github.com/KoYejune0302/bob-swe.git
cd bob-swe
Create a virtual environment:
python -m venv venv
source venv/bin/activate
Install dependencies:
pip install -r requirements.txt
Run the load_dataset.py script to load the SWE-Bench-Lite dataset and extract relevant data:
python load_dataset.py
This generates a JSON file (swe_bench_lite_dev.json) containing the extracted data.
Run the load_codebase.py script to clone the repositories at the specified base commit:
python load_codebase.py
The repositories are saved in the codebase/{instance_id} directory.
Run the extract_input.py script to extract relevant code snippets for each issue:
python extract_input.py
This generates input files (input_data/{instance_id}/input.txt) containing the problem statement and relevant code snippets.
Run the run_llm_{model_name}.py script to generate code diff patches using the SWE-Llama-7b model:
python run_llm_{model_name}.py
This generates a JSON file (model_patches_YYYYMMDD_HHMMSS.json) containing the patches.
pip install sb-cli
Before using the CLI, you'll need to get an API key:
sb-cli gen-api-key your.email@example.com
export SWEBENCH_API_KEY=your_api_key
# or add export SWEBENCH_API_KEY=your_api_key to your .*rc file
sb-cli verify-api-key YOUR_VERIFICATION_CODE
sb-cli submit swe-bench_lite dev --predictions_path {model_patch.json} --run_id {run_id}
sb-cli submit swe-bench_lite test --predictions_path {model_patch.json} --run_id {run_id}
swe_bench_lite_dev.json: Extracted dataset.codebase/{instance_id}: Cloned repositories.input_data/{instance_id}/input.txt: Extracted input for each issue.model_patches_YYYYMMDD_HHMMSS.json: Generated patches.The requirements.txt file contains all the dependencies for the project. Install them using:
pip install -r requirements.txt
DEFAULT_PROMPT_TEMPLATE in prompt.py to customize the prompt for the LLM.princeton-nlp/SWE-Llama-7b in run_llm_swe_llama.py with another model if needed.Missing Dependencies:
pip install -r requirements.txt.pip install tiktoken).GPU Issues:
python -c "import torch; print(torch.cuda.is_available())"
False, ensure CUDA is installed and compatible with your GPU.16 commits
Python
98.7%
Shell
1.3%