|Oct 31, 2022
|Oct 31, 2022
|Oct 13, 2022
#798 in Cryptography
Additional toolings for rust
rust_hero is a rust assistant that utilizes NLP to enhance the quality of rust code. It supports
lifetime (todo) prediction.
rust_hero = "0.5"
Classify unsafe Rust code
For each function in Rust, the
unsafe keyword utilizes the unsafe superpowers. However, the
unsafe keyword is not necessary if it can be taken out while the program is compiled successfully.
rust_hero infers the necessity of
unsafe keywords without the need of recompiling.
rust_hero trains a microsoft/codebert based model and take advantage of bert's strong reasoning capability to inference the necessity of
Implementation of the language query in this project is based on BrianHicks/tree-grepper.
It costs 2.06s and 2.90s on average for
rust_hero inferencing one rust file on Intel I7-12700K CPU and NVIDIA 3080 12GB GPU, seperately.
Inference speedup of rust_hero in Rust over rust_hero in Python
rust_hero written in Rust achieves up to 6.58X and 13.04X performance speedup over
rust_hero written in Python language for GPU and CPU, seperately.
Runtime dependencies for rust_hero
sudo apt install build-essential cmake pkg-config libssl-dev wget zip git
tree-grepper vendor (
cargo build also download the vendor automatically):
libtorch-1.12.0 （See rust-bert） to inference rust_hero. Download the libtorch with CPU or CUDA from following links:
Unzip the file and set the environment path in .bashrc:
or in 'envConfig' of work directory:
Prepare rust data for rust_hero test (optional):
50 rust files for testing is elaboratly selected from open-source rust project including on
Example usage for rust_hero:
cargo run data/error.rs
rust_hero also supports classifling all rust files of one directory:
cargo run data/