Skip to content

continuous1024/Paper2Code

Β 
Β 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

12 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ“„ Paper2Code: Automating Code Generation from Scientific Papers in Machine Learning

PaperCoder Overview

πŸ“„ Read the paper on arXiv

PaperCoder is a multi-agent LLM system that transforms paper into code repository. It follows a three-stage pipeline: planning, analysis, and code generation, each handled by specialized agents.
Our method outperforms strong baselines both on Paper2Code and PaperBench and produces faithful, high-quality implementations.


⚑ QuickStart

  • Note: The following command runs example paper (Attention Is All You Need).
  • πŸ’΅ Estimated cost for using o3-mini: $0.50–$0.70
pip install openai

export OPENAI_API_KEY="<OPENAI_API_KEY>"

cd scripts
bash run.sh

Output Folder Structure (Only Important Files)

outputs
β”œβ”€β”€ Transformer
β”‚   β”œβ”€β”€ analyzing_artifacts
β”‚   β”œβ”€β”€ coding_artifacts
β”‚   └── planning_artifacts
└── Transformer_repo  # Final output repository

πŸ“š Detailed Setup Instructions

πŸ› οΈ Environment Setup

  • Note: If you wish to use the o3-mini version, please make sure to install the latest version of the OpenAI package.
pip install openai

πŸ“„ Convert PDF to JSON

  1. Clone the s2orc-doc2json repository to convert your PDF file into a structured JSON format.
    (For detailed configuration, please refer to the official repository.)
git clone https://github.com/allenai/s2orc-doc2json.git
  1. Running the PDF processing service.
cd ./s2orc-doc2json/grobid-0.7.3
./gradlew run
  1. Convert your PDF into JSON format.
mkdir -p ./s2orc-doc2json/output_dir/paper_coder
python ./s2orc-doc2json/doc2json/grobid2json/process_pdf.py \
    -i ${PDF_PATH} \
    -t ./s2orc-doc2json/temp_dir/ \ 
    -o ./s2orc-doc2json/output_dir/paper_coder

πŸš€ Runing PaperCoder

  • Note: The following command runs example paper (Attention Is All You Need).
    If you want to run PaperCoder on your own paper, please modify the environment variables accordingly.
export OPENAI_API_KEY="<OPENAI_API_KEY>"

cd scripts
bash run.sh

About

Paper2Code: Automating Code Generation from Scientific Papers in Machine Learning

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 96.7%
  • Shell 3.3%