C2RustRep is a framework for automatic repository-level migration from C to Rust. It leverages fine-grained dependency analysis and reinforcement learning to enhance translation accuracy, safety, and idiomaticity.
dataset/: Contains datasets for evaluation, multi-task fine-tuning, and reinforcement learning (in JSONL format).inference/: Scripts for model inference and evaluation.train/: Training scripts for multi-task fine-tuning and reward-based reinforcement learning.
-
Prepare Data
Place the source C code and relevant datasets under thedataset/directory. -
Train the Model
Usetrain/lora_mft.pyfor multi-task fine-tuning, ortrain/lora_grpo.pyfor reinforcement learning with GRPO. -
Run Inference & Evaluation
Useinference/main.pyto perform translation and evaluate results.
- This project emphasizes the automation workflow and evaluation of repository-level C-to-Rust migration.
- For implementation details, please refer to the corresponding script files.
- Requires basic knowledge of Python, Git, and deep learning frameworks.